|
Numeric.IEEE | Stability | experimental | Maintainer | Patrick Perry <patperry@stanford.edu> |
|
|
|
|
|
Description |
Approximate comparison of floating point numbers based on the
algorithm in Section 4.2.2 of Knuth's _Seminumerical Algorithms_
and NaN-aware minimum and maximum.
Relative accuracy within eps is measured using an interval of size 2*r,
where r = 2^k eps, and k is the maximum exponent of x and y. If
x and y lie within this interval, they are considered approximately
equal.
Note that x and y are compared to relative accuracy, so these functions
are not suitable for testing whether a value is approximately zero.
The implementation is based on the GNU Scientific Library implementation,
which is based on the package fcmp by T.C. Belding.
|
|
Synopsis |
|
|
|
|
NaN-aware minimum and maximum
|
|
|
A version of max that returns NaN if either argument is NaN.
|
|
|
A version of min that returns NaN if either argument is NaN.
|
|
Relative comparisons
|
|
|
A value suitable for relative comparisons when half of of the
digits of precision are important. For Doubles this value is
7.450580596923828e-9.
|
|
|
The smallest positive floating-point number x such that 1 + x != 1.
Suitable for relative comparisons when all but the least significant digit
of precision are important. For Doubles this value is
2.220446049250313e-16.
|
|
|
The smallest positive floating-point number x such that 1 - x != 1.
Suitable for relative comparisons when one number is exact and all but the
least significant digit of precision in the other number are important.
For Doubles this value is 1.1102230246251565e-16.
|
|
|
eqRel eps x y. Relative equality comparator.
Returns False if either argument is NaN.
|
|
|
neqRel eps x y. Relative inequality comparator.
Returns False if either argument is NaN.
|
|
|
ltRel eps x y. Relative less-than comparator.
Returns False if either argument is NaN.
|
|
|
lteRel eps x y. Relative less-than-or-equal-to comparator.
Returns False if either argument is NaN.
|
|
|
gtRel eps x y. Relative greater-than comparator.
Returns False if either argument is NaN.
|
|
|
gteRel eps x y. Relative greater-than-or-equal-to comparator.
Returns False if either argument is NaN.
|
|
|
compareRel eps x y gives an ordering of x and y based on a
relative comparison of accuracy eps. This will call error if either
argument is NaN.
|
|
Produced by Haddock version 2.4.2 |