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 4309 - fn-insert-before-mix-args-010 has invalid float value
Summary: fn-insert-before-mix-args-010 has invalid float value
Status: CLOSED INVALID
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 1.0.2
Hardware: Other Linux
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-08 14:23 UTC by Frans Englich
Modified: 2007-09-12 10:37 UTC (History)
0 users

See Also:


Attachments

Description Frans Englich 2007-02-08 14:23:51 UTC
fn-insert-before-mix-args-010's query reads:

fn:insert-before( ("a", "b", "c"),2, xs:float("-0")) 

the expected base line is: "a 0 b c"

To me this seems wrong. 17.1.2 Casting to xs:string and xs:untypedAtomic reads:
"If SV has the value positive or negative zero, TV is "0" or "-0" respectively."

Saxon evaluates the above to "a -0 b c", which is what I would expect.

In revision 1.5 of the file, the baseline changed from -0.0E0 to 0, without documenting why:

http://dev.w3.org/cvsweb/2006/xquery-test-suite/TestSuiteStagingArea/ExpectedTestResults/Functions/SeqFunc/GeneralSeqFunc/SeqInsertBeforeFunc/fn-insert-before-mix-args-010.txt.diff?r1=1.4&r2=1.5&f=h


Frans
Comment 1 Frans Englich 2007-02-08 14:28:09 UTC
To be a bit more specific: the baseline reading "a 0 b c" should be removed, unless I'm not mistaken.
Comment 2 Michael Kay 2007-02-08 15:32:14 UTC
IIRC the spec says that when casting the string "-0" to float, it's implementation-defined whether you get negative or positive zero. (The reason is to do with the fact that Schema 1.0 doesn't have a distinct negative zero in the value-space)

The change from 0.0e0 to 0 was to fix a bug: floating point zero when converted to a string should give you "0".
Comment 3 Frans Englich 2007-02-08 18:12:09 UTC
Ok. In that case the paragraph in 17.1.2 contradicts it, since it makes a distinction for positive and negative zero. It would be cool with a pointer to where it's mentioned how this serialization is implementation defined.

Maybe a candidate for errata.


Frans
Comment 4 Frans Englich 2007-09-12 09:44:24 UTC
Mike, section 17.1.2 Casting to xs:string and xs:untypedAtomic reads:

If ST is xs:float or xs:double, then:
If SV has the value positive or negative zero, TV is "0" or "-0" respectively.

doesn't this mandate that xs:float("-0") must serialize to "-0"?
Comment 5 Michael Kay 2007-09-12 09:59:14 UTC
xs:float("-0") is allowed to return positive or negative zero. This was decided because XML Schema 1.0 doesn't actually recognize negative zero.

If it returns negative zero then it must serialize as "-0"; if it returns positive zero then it must serialize as "0".

Michael Kay
Comment 6 Frans Englich 2007-09-12 10:37:14 UTC
I see. Rejecting.