[A83] Re: 83p os


[Prev][Next][Index][Thread]

[A83] Re: 83p os



> > When is there a case where you can't expand a number of any exponent?
> > The only reason I can think of is if limited memory is available for
conversion
> > to base 10.
> Exactly that's what I'm talking about. There must be a better way. If we
> need a precision of, say, 15 decimal digits, why would we have to expand
> a 15000-digit binary number before the conversion?

Hmmm, good point.  Is there some way to determine the number of binary
digits required to yield 15, or any specific number, accurate decimal
digits?  Maybe (calculating in progress)...

50 binary digits can represent any 15-digit decimal number.  Therefore,
rounding to the next byte boundary, 56 bits (7 bytes) of expansion storage
should be sufficient to reduce rounding error.   That leaves the problem of
resolving the binary exponent to a decimal exponent, and conversion to
decimal without the use of lesser significant decimal digit storage.  I
think that this can be solved by allotting 10? bytes (15 decimal digits plus
5? digit exponent) to each of two decimal storage buffers.  Then, conversion
would take place by adding 2 to the "temp" decimal buffer [binary place
value] number of times, then the "temp" buffer would be decimally added to
the "display" buffer, and this would happen for every binary "1".
Then, 1 would be added if the number is odd.

This is a possible substitute for (binary-to-decimal conversion by complete
expansion of a binary floating-point number) for the sake of storage space
saving.  This plan would require little space but vastly greater calculation
time.  Also, this plan could use a huge binary exponent via a few more bytes
here and there, whereas the compete expansion plan is limited to a
relatively small exponent, related to space available.  Lastly, this plan
might be less accurate, while complete expansion is more, if not entirely,
accurate.  There is an obvious tradeoff.

> "I unreservedly agree, comrade." :)
Hehe.  Just curious, where or who did you quote that from?

Jeff



Follow-Ups: References: