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

[XPath 2.0] 3.5.2 General Comparisons

From: Michael Kay <mhk@mhk.me.uk>
Date: Fri, 6 Feb 2004 17:47:34 -0000
To: <public-qt-comments@w3.org>
Message-ID: <000d01c3ecd9$4e0f74c0$6401a8c0@pcukmka>

The current rules for backwards compatibility in general comparisons
reads:

<old>
If XPath 1.0 compatibility mode is true, and at least one of the atomic
values has a numeric type, then both atomic values are cast to to the
type xs:double.
</old>

[Note also the typo: "to to"]

This means that if both the values are xs:decimal values, they must both
be converted to xs:double values for comparison. This seems
unreasonable, given that two xs:decimal values can be unequal when
compared as decimals, but equal when converted to doubles. 

Since it's entirely OK to compare two numeric values of different atomic
type, there doesn't seem to be a good reason for converting both
operands to double, rather than only converting one; nor is there a good
reason for converting to xs:double if the value is already numeric. I
suggest changing the rule to:

<new>
If XPath 1.0 compatibility mode is true, and if one of the atomic values
has a numeric type and the other does not, then the value that is not
numeric is cast to the type xs:double.
</new>

Michael Kay
Received on Friday, 6 February 2004 12:47:08 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC