Float Question

Rick Zaccone zaccone at bucknell.edu
Sun Jan 3 19:09:32 UTC 1999


>>          11 bits   - value minus 1023 to produce an exponent in the range
>>                         -1023 .. +1024
>
>          [should be -1023 .. +1023, emax=1023]

Correct, emax is 1023.  The unbiased exponents e=0 and e=2047 along
with the value of the fraction indicate NaN, infinity, denormalized
numbers and signed zero.

>>>        fmax Definition: Report the largest value allowed by the
>>>characterized floating point object representation. This satisfies the
>>>ISO/IEC 10967 floating point characterization requirement fmax, and is
>>>equal to:
>
>>     (1 - (self radix raisedTo: self precision negated)) *
>>          (self radix raisedTo: self emax)
>
>
>I think this equation is off by a power of 2, or the definition of "emax"
>is wrong:
>
>     (1 - (2 raisedTo: 53 negated)) => number slightly less than 1.0
>
>if we multiply this by (2 raisedTo: 1023) we get
>
>      8.98846567431157e307
>
>which is exactly half the correct value (1.797693134862315e308)

The largest possible double precision number is (there are 52 1's
after the radix point):

2^1023 x 1.1111...1   = 2^1023 (2 - 2^{-52})
                      = 2^1024 (1 - 2^{-53})       <- what was intended above
                      = 2^1024 - 2^971
                      \approx 1.797693134862316 x 10^308

So the equation is off by a factor of two.

Rick Zaccone
--
zaccone at bucknell.edu





More information about the Squeak-dev mailing list