The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math

Topic: bcd arithmetic
Replies: 1   Last Post: Jun 15, 1996 7:59 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Paul Schlyter

Posts: 84
Registered: 12/7/04
Re: bcd arithmetic
Posted: Jun 15, 1996 7:59 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <4ppa96$>,
Vidhyanath K. Rao <> wrote:

> In article <4phmie$>,
> Dann Corbit <> wrote:

>>This approach works in simplistic terms, for instance, when you are adding
>>two amounts. But how do you figure tax using only integers? If you
>>use only integer types, how do you figure interest, which is an exponential?
>>You are back to using floating point in either case, which never eliminates
>>the problem.

> The answer, used by FORTH, is to a new operation */ which computes
> (a*b)/c, returning the quotient and remainder, with a*b kept in
> -double length- format.
> The trouble with floating most people complain about is due to the fact
> that the mantissa has fewer bits/digits than fixed types taking up
> the same amount of memory. Floating point is used for calculations
> not due to inherenet superiority, but due to the fact that highly
> tuned floating point units are common, while typical ALU's do not make
> such things as */ operations easy to implement.

One ALU where this is easy to implement is the ALU in the Intel 80x86
series of CPU's, where the machine instruction for integer multiply
leaves a double-precision result, and the instruction for integer
divide expects a double-precision numerator to be divided by a
single-precision denominator. Thus an 8x8 bit multiply leaves a
16-bit product, a 16x16 bit multiply leaves a 32-bit product (in two
16-bit CPU registers) and a 32x32 bit multiply leaves a 64-bit
product (in two 32-bit CPU registers). The division can then divide
this double-precision integer result with some single-precision

Paul Schlyter, Swedish Amateur Astronomer's Society (SAAF)
Grev Turegatan 40, S-114 38 Stockholm, SWEDEN

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.