M
Mike Cowlishaw
This has already been rehashed to death. Use an appropriate scaling
This is, indeed, how decimal arithmetic has been done in the
past. It is no longer an adequate or acceptable approach.
It's a valid approach for binary FP, too, and 'manual'
scaling of binary calculations is perfectly feasible.
But it is difficult, tedious, and error-prone.
In addition to these problems, the 'scaled binary'
approach for decimal means that one is constantly
carrying out base conversions. With decimal FP
as the foundation, no base conversions occur.
Mike Cowlishaw
factor and all these computations can be performed exactly using
binary floating point, or, even better, long long arithmetic. Before
C99, the
usual portable solution was double precision, but 64-bit integer
arithmetic is even more appropriate to this kind of applications.
Maybe
even more appropriate than decimal floating point arithmetic
(depending
on the size of the mantissa and the scaling factor imposed by the
application).
This is, indeed, how decimal arithmetic has been done in the
past. It is no longer an adequate or acceptable approach.
It's a valid approach for binary FP, too, and 'manual'
scaling of binary calculations is perfectly feasible.
But it is difficult, tedious, and error-prone.
In addition to these problems, the 'scaled binary'
approach for decimal means that one is constantly
carrying out base conversions. With decimal FP
as the foundation, no base conversions occur.
Mike Cowlishaw