[A83] Re: 83p os


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

[A83] Re: 83p os



> > Let's see, that means 1.01001100110 with decimal point shifted right 234
> > decimal places.  That means 101001100110 with 223 more zeroes.  Hmmm,
> > that means 2662*2^223, which equals
3.5883689013977501566701797080823*10^70.
> > Oh wait, that's too much significance...
>
> The problem is if the exponent is so great that you can't simply expand
> the number for the divisions by 10.

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.

Isn't that what overflow is for?  If we have a limited *space* for
expansion, then we just set the overflow limit accordingly with our memory
constraints.  In your example, 30 bytes will store "1.01001100110b *
10b^11101010b (b indicates that the number is a binary number)" in expanded
form, and each nibble in 36 bytes can store the decimal digits of the entire
decimal value.  I don't think that dedicating some bytes to decimal
conversions should be too much of a problem, if that's what it comes to.

IMHO, the advantages of speedy binary math outweighs the advantages of BCD
and related decimal math, on a microprocessor like the Z80.  Math is math,
AFAIK - both binary and decimal math should yield similar and accurate
results.  Remember that conversion to decimal in a binary math system only
needs to occur when actually displaying a stored number.

Jeff



Follow-Ups: References: