W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2004

RE: [F&O] 6.3 NaN difference between XQuery and XMLSchema

From: Ashok Malhotra <ashok.malhotra@oracle.com>
Date: Thu, 16 Dec 2004 17:47:13 -0800
To: Sarah Wilkin <swilkin@apple.com>, public-qt-comments@w3.org
Message-ID: <20041216174714147.00000001772@amalhotr-pc>

As you correctly point out, F&O uses IEEE 754 arithmetic which is at
variance with XML Schema is two ways: XML Schema says that NaN equals
itself and defines only a single zero.  These will be corrected in XML
Schema 1.1.

If the WGs agree, we could amplify the note in 6.1 a bit to make this clearer.  For example:

This specification uses IEEE-754 arithmetic for xs:float and xs:double values.
This differs from [XML Schema Part 2: Datatypes Second Edition] which defines
NaN as being equal to itself and defines only a single zero. [IEEE 754-1985] arithmetic, however,  treats NaN as unequal to all other values including itself and can produce distinct results of positive zero and negative zero. (These are two different machine representations for the same [XML Schema Part 2: Datatypes Second Edition] value.) The text accompanying several functions discusses behaviour for both positive and negative zero inputs and outputs in the interest of alignment with [IEEE 754-1985].

All the best, Ashok

> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of Sarah Wilkin
> Sent: Thursday, December 16, 2004 10:07 AM
> To: public-qt-comments@w3.org
> Subject: [F&O] 6.3 NaN difference between XQuery and XMLSchema
> In section 6.3:
> "NaN does not equal itself "
> But in the XMLSchema 3.2.5: http://www.w3.org/TR/xmlschema-2/#double
> "NaN equals itself but is .incomparable. with (neither 
> greater than nor less than) any other value in the .value space.. "
> I believe this discrepancy exists because most floating point 
> operations in XQuery use the IEEE 754 standard. If this is 
> the case, a note similar to others referencing IEEE 754 
> should be added. 
> Alternatively, a consolidated section describing when to use 
> IEEE 754 for operations/comparisons on xs:float and xs:double 
> could be added to 6.1.
> --Sarah
Received on Friday, 17 December 2004 01:47:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:22 UTC