This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 2643 - [F+O] Conversion from double to float
Summary: [F+O] Conversion from double to float
Status: CLOSED INVALID
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Ashok Malhotra
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-05 13:18 UTC by Michael Kay
Modified: 2006-01-17 16:23 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2006-01-05 13:18:30 UTC
In 17.1.3.1 we have blindly copied from XML Schema Part 2 the assertion that the
mantissa of a single-precision floating point number is in the range (-2^24+1 to
+2^24-1). This is incorrect. It is actually in the range (-2^23+1 to +2^23-1).

I have reported this as a bug against XML Schema Part 2:

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2642
Comment 1 Naresh Chainani 2006-01-05 17:42:37 UTC
(In reply to comment #0)
I believe the value space specified for float in XML Schema Part 2 is correct. 
XML Schema states that "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."

IEEE754 single-precision floating point representation has 1 sign bit, 8 
exponent bits and 23 physical mantissa bits + 1 logical mantissa bit. The 
logical mantissa bit is always 1 and hence is not stored in the physical 
representation. But it does result in the absolute value of mantissa being 
(2^24-1).

Similar argument applies to double precision floating point, where there are 
52 physical mantissa bit + 1 logical mantissa bit, which results in absolute 
value of mantissa being (2^53-1).

Having argued that the values spaces for float and double in XML Schema are 
correct, I do agree that the F&O has a typo in the range you point out below. 
The range should read:
 (-2^24-1 to +2^24-1), and not
 (-2^24+1 to +2^24-1)
Comment 2 Michael Kay 2006-01-17 16:21:39 UTC
Thank you for the clarification. I am withdrawing this comment.

Michael Kay