aizu-m opened a new pull request, #174:
URL: https://github.com/apache/poi-xmlbeans/pull/174

   [xs:float] minInclusive 0, value -0
          XMLBeans = INVALID: cvc-minInclusive-valid
          Xerces   = VALID
   
       [xs:float] unique 0 / -0
          XMLBeans = VALID
          Xerces   = INVALID: cvc-identity-constraint.4.1: Duplicate unique 
value [0.0E1]
   
   Found these in a differential run of XmlObject.validate() against the JDK 
Xerces validator over xs:float and xs:double: 14 disagreements, every one with 
-0 on a side.
   
   They all come from JavaFloatHolder.compare, which drops through to a 
floatToIntBits tie-break once neither < nor > holds. floatToIntBits(-0.0f) is 
0x80000000, so -0 sorts below 0 and never compares equal to it. 
JavaDoubleHolder.compare does the same with doubleToLongBits. The tie-break is 
there for NaN, which has to equal itself although NaN == NaN is false in Java; 
signed zero reaches it by accident. XML Schema Part 2 3.2.4 gives float the 
value space m x 2^e plus the three special values, so there is one zero and -0 
and 0 are the same value.
   
   Four observations. xs:unique and xs:key miss a duplicate pair 0 / -0, 
because IdentityConstraint keys field values on valueEquals and valueHashCode. 
xs:keyref rejects a reference written -0 against a key written 0. 
minInclusive='0' rejects -0 and maxInclusive='-0' rejects 0, while 
minExclusive='-0' accepts 0, and enumeration value='0' does not match -0. 
XmlObject.valueEquals, compareValue and valueHashCode disagree with the value 
space.
   
   Both compare methods now return 0 when the two values are IEEE-equal, ahead 
of the bit tie-break, and value_hash_code maps -0 onto 0 so valueEquals and 
valueHashCode stay in step. NaN keeps the tie-break, so it still equals itself 
and nothing else. Every other value behaves as before, and all 14 cases agree 
with Xerces after the change. Regression test added.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to