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.11Mb 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

The Foundation: Jack Emery 1 by Steve P. Vincent
The Kneebone Boy by Potter, Ellen
Mad Powers (Tapped In) by Mark Wayne McGinnis
Undead and Unemployed by MaryJanice Davidson
Divorcing Jack by Colin Bateman
Disruption by Whibley, Steven
A Handful of Darkness by Philip K. Dick