× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: A Packed-Decimal Machine? (was Entry Parameters)
  • From: Jim Langston <jlangston@xxxxxxxxxxxxxxxx>
  • Date: Fri, 21 Jan 2000 07:35:55 -0800
  • Organization: Conex Global Logistics Services, Inc.

I think you said it right there, if Packed is faster than Binary,
isn't it a conclusion that Binary is converted to Packed before
math occurs?

I know on Intel's 80x80 there is one instruction that converts
from binary to BCD (Binary Coded Decimal, which Packed
seems to be a variant of).  With overflow checking and whatnot,
it probably runs into 7 or so machine instructions.

The main advantage on converting to BCD before doing math
is accuracy on floating point numbers, or any number with a
decimal point.  I was looking at what would be required to
write my own math routines for floating point numbers in
assembly on a 80386 at one time where I found that there is
an inherent inaccuracy on doing math on binary floating point
numbers.  The errors come in when converting from/to binary
to decimal.  Using BCD  you don't' have that problem.

Everything I have seen makes me think the AS/400 on the
machine level uses BCD math instead of hex math whenever
it can.

Regards,

Jim Langston

Jon.Paris@halinfo.it wrote:

> <SNIP>
> To get an idea how big an effect this can have try coding a loop that does 
>(say)
> a multiply of one 5 digit integer by another 10,000 times.  Code the integers 
>as
> type B(inary), P(acked) and I(nteger) and compare the times taken. You should
> find that I is fastest followed by P and then B.  The new optimizer on the 
>Risc
> 400s may do enough work that the differences will not be as obvious as they 
>used
> to be but .....

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.