- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Thu, 9 Oct 2003 18:42:26 +0200
- To: Ashok Malhotra <ashokma@microsoft.com>, Sarah Wilkin <swilkin@apple.com>, public-qt-comments@w3.org
- Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD1A8@daemsg02.software-ag.de>
> Sarah: > Thank you for your comment. This has been fixed. The > (single) rule now > reads: > > - If ST is xs:float or xs:decimal, or types derived from > them, then TV is xs:double(SV cast as xs:string) and the > conversion is complete. > Sarah also asked: Also, why would float need to be first cast to a string when double represents a superset of its values (both for the actual value as well as mantissa and exponent)? I have to say I am confused by this myself. I have also heard it suggested that the reason xs:float is not defined in XML Schema as a subtype of xs:double is that the value space of xs:float is not a subset of the value space of xs:double. The Java language spec says: The finite nonzero values of type float are of the form s.m.2^e, where s is +1 or -1, m is a positive integer less than 2^24, and e is an integer between -149 and 104, inclusive. Values of that form such that m is positive but less than 2^23 and e is equal to -149 are said to be denormalized. The finite nonzero values of type double are of the form s.m.2^e, where s is +1 or -1, m is a positive integer less than 2^53, and e is an integer between -1075 and 970, inclusive. Values of that form such that m is positive but less than 2^52 and e is equal to -1075 are said to be denormalized. These definitions certainly suggest that the value space of float is a subspace of double. So why isn't float a subtype of double, and why do we convert from one to the other via a string? Michael Kay
Received on Thursday, 9 October 2003 12:42:52 UTC