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 4881 - Should -NaN be allowed and given a meaning?
Summary: Should -NaN be allowed and given a meaning?
Status: CLOSED WORKSFORME
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Datatypes: XSD Part 2 (show other bugs)
Version: 1.1 only
Hardware: Macintosh All
: P4 major
Target Milestone: ---
Assignee: C. M. Sperberg-McQueen
QA Contact: XML Schema comments list
URL:
Whiteboard: cluster: numbers
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2007-07-25 13:32 UTC by C. M. Sperberg-McQueen
Modified: 2008-05-16 17:15 UTC (History)
0 users

See Also:


Attachments

Description C. M. Sperberg-McQueen 2007-07-25 13:32:39 UTC
In his survey of the impact of precision decimal on XPath and XQuery
(http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2006May/0023.html)
[member-only link], Don Chamberlin observes

    In 754r Section 5.10 we read "totalorder(-NaN, number) is 
    true where -NaN represents a NaN with negative sign bit". 
    (But there is no negative NaN value in XML Schema.)

It would appear from this that IEEE 754R assigns distinct meaning,
for ordering purposes, to the sign bit of NaN values.  Our
description of precisionDecimal requires the sign to be absent
when the numericalValue is notANumber.  Our float and double
types have a NaN, but no negative NaN.

If IEEE 754 does assign ordering or processing semantics to 
-NaN, it may perhaps be useful for XPath and the other QT
specs if XSDL distinguishes NaN and -NaN.

Should our description of NaN be modified to follow 754?
Comment 1 Dave Peterson 2007-08-06 03:33:20 UTC
(In reply to comment #0)

>     In 754r Section 5.10 we read "totalorder(-NaN, number) is 
>     true where -NaN represents a NaN with negative sign bit". 
>     (But there is no negative NaN value in XML Schema.)
> 
> It would appear from this that IEEE 754R assigns distinct meaning,
> for ordering purposes, to the sign bit of NaN values.  Our
> description of precisionDecimal requires the sign to be absent
> when the numericalValue is notANumber.  Our float and double
> types have a NaN, but no negative NaN.
> 
> If IEEE 754 does assign ordering or processing semantics to 
> -NaN, it may perhaps be useful for XPath and the other QT
> specs if XSDL distinguishes NaN and -NaN.

It's true that 754R provides for this alternate total ordering (which differs from the usual not-quite-total ordering, also provided for).  However, 754R in 7.12.1 prescribes that "quiet" NaNs are to be represented lexically as "nan" or some partially or entirely capitalized variant, and that "signaling" NaNs are to be similarly represented by "snan" or "nan".  In either case, no sign is allowed.  If we wish to cover the case of the sign bit of NaNs in out lexical representations, according to 8.2.1 we must in addition to "nan" (or the optional "snan") provide a bit patern that sets out all of the system-defined-meaning bits that can vary in the various NaNs.  The WG considered and rejected long ago the option (IIRC, WRT float and double) of specifying such bit patterns.  Need we reopen that question?
Comment 2 Dave Peterson 2007-08-07 02:41:14 UTC
(In reply to comment #1)

> allowed.  If we wish to cover the case of the sign bit of NaNs in out lexical
> representations, 
s/in out/in our/

Sorry.  :-(
Comment 3 C. M. Sperberg-McQueen 2007-12-17 15:59:10 UTC
The editors discussed this on the editors' call this morning.  Comment #1 
may be in error in saying the lexical form '-NaN' is not allowed (section 
5.12.1 appears to allow it, but explicitly says that it has no meaning).

Section 6.3 says that IEEE 754R (draft 1.5.0, October 2007) does not 
interpret the sign bit of NaNs.

The editors recommend to the WG that this issue be closed without change, as
WORKSFORME.
Comment 4 C. M. Sperberg-McQueen 2008-05-16 17:15:40 UTC
At the telcon of 16 May 2008, the XML Schema WG adopted the proposal
in comment #3 to close this issue as WORKSFORME.