largest finite float

Some time ago, it was suggested that the XML Schema spec should
specify clearly the range of numbers representable by our float type,
and make explicit when numbers round to the largest finite value and
when they round to infinity.

A piece of paper I've just found on my desk gives Dave Peterson's
answer to the first of these questions.  I'm sending this mail to the
XML Schema comments list so as to ensure that this topic gets into the
queue of candidate changes for XML Schema, and to get this piece of
paper off my desk and off my conscience.

The largest finite float, if I understand the notes correctly, is

    m * 2**e

where ** means exponentiation,
        m is the largest number representable in the mantissa, and
        e is the largest number representable as an exponent

Since we have

   m = 2 ** 24 - 1
   e = 127

it follows that

   m * 2**e = (2**24) * (2**127) - 2**127
            = 2**151 - 2**127

The decimal expansion of this is approximately 2.85449517E+45, or
exactly 2854495215270736301647340207211686556881387520.  With commas,
that's 2,854,495,215,270,736,301,647,340,207,211,686,556,881,387,520.
(Calculation courtesy of Regina, an implementation of the Rexx
programming language which supports sufficient precision to make this
an exact calculation.)

Some things are, unfortunately, not so clear to me:

   (a) what the next largest float would be if we had one
   (b) where the watershed point is between infinity and 2.85...E45
   (c) whether the negative numbers are exactly the same as these
       plus a minus sign, or divergent in some way

I don't believe there has been any confusion over the watershed
between zero and the smallest representable float.

Dave, if you can confirm that I have correctly interpreted your
notes, I'd be grateful.  Ditto if anyone can shed light on questions
(a), (b), (c) above.

-C. M. Sperberg-McQueen

Received on Tuesday, 22 January 2002 10:29:21 UTC