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
8.04Mb 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

Tangled Up in Love by Heidi Betts
Marked by Denis Martin
Recessional: A Novel by James A. Michener
Here and Again by Nicole R Dickson
El sueño de Hipatia by José Calvo Poyato
Suncatchers by Jamie Langston Turner
Late for the Wedding by Amanda Quick