EXPath binary module - comments - negative zero

On 02/08/2013 18:01, Michael Kay wrote:
> 2. Negative zero
>
> I think section 8.3 gets this wrong. XDM 3.0 section 2.7.7 says:
>
> <quote>
>
> The |xs:float| and |xs:double| data types in the data model have the 
> same value space as in XML Schema 1.1 ([Schema 1.1 Part 2] 
> <http://www.w3.org/TR/xpath-datamodel-30/#xmlschema11-2>). 
> Specifically they include both negative and positive zero, and in this 
> respect they differ from XML Schema 1.0.
>
> To accommodate this difference, when converting from an |xs:string| to 
> an |xs:float| or |xs:double|, it is implementation-defined whether the 
> lexical value “-0” (and similar forms such as “-0.0”) convert to 
> negative zero or to positive zero in the value space.
>
> </quote>
>
> So for XPath 3.0, since the data model must include a negative zero, 
> it's reasonable that the corresponding IEEE value should produce a 
> negative zero.
>
> For XPath 2.0, the specs are less definitive; XDM says nothing, but 
> F+O says (admittedly in a Note): "This specification uses [IEEE 
> 754-1985] <http://www.w3.org/TR/xpath-functions/#ieee754> arithmetic 
> for |xs:float| and |xs:double| values. This differs from [XML Schema 
> Part 2: Datatypes Second Edition] 
> <http://www.w3.org/TR/xpath-functions/#xmlschema-2> " which carries a 
> strong implication that there are functions and operators for which a 
> return value of negative zero is required.
>
Fair enough - I'll make suitable alterations. I must admit I've found it 
somewhat confusing that at least for XPath 3.0 there appears to be 
reference to XMLSchema 1.1 which is a more recent version than XML 
Schema 2 - but of course the devil is in the detailed wording. XML 
Schema Part 2 /is/ older than XML Schema 1.1 Part 2. I'll get the hang 
of it some day...

John


-- 
*John Lumley* MA PhD CEng FIEE
john@saxonica.com <mailto:john@saxonica.com>
on behalf of Saxonica Ltd

Received on Monday, 5 August 2013 08:57:01 UTC