[Bug 2642] Value space for xs:float is incorrect

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2642





------- Additional Comments From davep@iit.edu  2006-01-05 17:17 -------
(In reply to comment #0)

> The basic ˇvalue spaceˇ of float consists of the values m × 2^e, where m is an
> integer whose absolute value is less than 2^24, and e is an integer between -149
> and 104, inclusive. 
> 
> This is incorrect: it would require 33 bits to represent this value space. In
> fact, single precision floating point allocates 1 bit for the sign, 8 bits for
> the exponent, and 23 bits for the (unsigned) mantissa. The description should read:
> 
> The basic ˇvalue spaceˇ of float consists of the values m × 2^e, where m is an
> integer whose absolute value is less than 2^23, and e is an integer between -149
> and 104, inclusive.

No, the description is correct.  Because float and double do not carry variable
precision, ANSI/IEEE 754 was able to design the bit layout so that for "normal"
numbers, there is an implied 1 bit tacked onto the unsigned m.  (BTW, "mantissa"
is the wrong word; the mantissa is the fractional part of the log of m.)  For "subnormal"
numbers, the extra 1 bit is not tacked on; this allows filling in the region between
zero and the smallest "normal" number.  "Normal" in this sense means that the
number is expressible with an m and e such than  2^23 <= m  (in addition to the
general requirement of  0 < m < 2^24  and  -149 <=e <= 104 ).

Received on Thursday, 5 January 2006 17:18:37 UTC