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

Hannah by Andrea Jordan
American Goth by J. D. Glass
Permanent Adhesives by Melissa T. Liban
No Turning Back by Kaylea Cross
Chasing Shadows by Rebbeca Stoddard
Empty Nests by Ada Maria Soto
Playing With Fire by Ashley Piscitelli
The Triad of Finity by Kevin Emerson
Paxton's War by Kerry Newcomb