XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (96 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
2.28Mb size Format: txt, pdf, ePub

Except for NaN, number values are
ordered
. Arranged from smallest to largest, they are:

  • Negative infinity
  • Negative finite non-zero values
  • Zero (positive and negative zero are equal to each other)
  • Positive finite non-zero values
  • Positive infinity

This ordering determines the result of less-than and greater-than comparisons, and in XSLT it determines the result of sorting using

or

with a sort key specified using

.

NaN is
unordered
, so the operators
<
,
<=
,
>
, and
>=
return false if either or both operands are NaN. However, when

is used to sort a sequence of numeric values that includes one or more NaN values, NaN values are collated at the start of the sequence (or at the end if you choose descending order).

Positive zero and negative zero compare equal. This means that the operators
=
,
<=
, and
>=
return true, while
!=
,
<
, and
>
return false. However, other operations can distinguish positive and negative zero; for example,
1.0 div $x
has the value positive infinity if
$x
is positive zero, and negative infinity if
$x
is negative zero.

Other books

Takedown by Rich Wallace
Girl in Pieces by Kathleen Glasgow
Innocence: A Novel by Dean Koontz
Bears Beware! by Bindi Irwin
Spit Delaney's Island by Jack Hodgins
A Four Letter Word by Michelle Lee