HP-UX Floating-Point Guide
62 Chapter 2
Floating-Point Principles and the IEEE Standard for Binary Floating-Point Arithmetic
Floating-Point Operations
Round to
Nearest
Integral Value Rounds an argument to the nearest integral value (in
floating-point format) based on the current rounding
mode. Rounding modes are described in “Inexact
Result (Rounding)” on page 53.
Remainder The remainder operation takes two arguments, x and y,
and is defined as x − y * n, where n is the integer
nearest the exact value x/y. See “The Remainder
Operation” on page 66 for more information.
To understand the properties of each operation, you need a full
understanding of denormalized numbers, infinities, and NaNs (see
“Normalized and Denormalized Values” on page 41, “Infinity” on
page 43, and “Not-a-Number (NaN)” on page 45). HP 9000 systems
conform to the IEEE standard for all of these operations.
The standard requires that the result of each operation be rounded from
its mathematically exact value into an IEEE representation in
accordance with the rounding mode. In round-to-nearest mode (the
default), the result is within 1/2 ULP. (There is one exception to this rule;
conversions between binary and decimal need not be rounded perfectly
at the extremes of their ranges.)
Comparison
The comparison operation determines the truth of an assertion about the
relationship of two floating-point values. The four basic assertions are
operand1 < operand2 The first operand is less than the
second.
operand1 = operand2 The first operand is equal to the
second.
operand1 > operand2 The first operand is greater than the
second.
operand1 ? operand2 Unordered. This assertion is true if
either operand is a NaN.
The basic assertions can be combined with each other. For example,
“a >= b” asserts that a is greater than or equal to b. Similarly, “a <> b”
asserts that a is either greater than or less than b; for operands that are
not NaNs, this assertion is the opposite of “a = b”.