Name
xs:double
Synopsis
Defined in: XML Schema part 2
This datatype maps directly to the XPath concept of number, and thus can be useful in situations where data flows back and forth between XPath and the XML instance data.
Caveats
Unlike the decimal datatypes, xs:double is based
on an internal binary representation, so many operations
(particularly comparisons) are only approximations. The lexical space
of this datatype allows scientific notation, so you need to be
careful not to assume that any particular representation will always
be used. Also, special values of NaN (not a
number), INF (infinity), -INF
(negative infinity), as well as negative zero, are possible.
NaN in particular behaves strangely in
comparisons, being equal to itself and greater than all other
numbers, even INF!
Examples
3.14159
3.14159E0
NaN
0
-0
INF
-INF
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access