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
Get XForms Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.