Skip to main content

Module eft

Module eft 

Source
Expand description

Error-free transformations: floating-point sums and products together with their exact rounding errors.

Every function returns a pair (x, y) where x is the correctly rounded floating-point result of the operation and y its rounding error, so that x + y equals the real result exactly. This holds under the requirement documented on each function, assuming the default round-to-nearest-even mode. NaN and infinite inputs are not supported.

The algorithms are those of Knuth, Dekker and Veltkamp as presented by Shewchuk, “Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates” (1997). When the target has a hardware fused multiply-add (see HAS_FMA), the exact product uses it instead.

Constants§

HAS_FMA
True when two_product uses a fused multiply-add on this target.
PRODUCT_OPERAND_MAX
2^480, the largest magnitude in the product domain. See in_product_domain.
PRODUCT_OPERAND_MIN
2^-480, the smallest nonzero magnitude in the product domain. See in_product_domain.

Functions§

fast_two_sum
Computes a + b and its rounding error, faster than two_sum when the magnitudes are known to be ordered (Dekker’s fast-two-sum).
in_product_domain
Returns true if x lies in the product domain: it is zero of either sign, or its magnitude is in PRODUCT_OPERAND_MIN..=PRODUCT_OPERAND_MAX, that is 2^-480 ..= 2^480.
two_diff
Computes a - b and its rounding error.
two_product
Computes a * b and its rounding error with the crate’s selected implementation: two_product_fma when HAS_FMA is true, and two_product_dekker otherwise. Both give equal values.
two_product_dekker
Computes a * b and its rounding error with Dekker’s algorithm, using only additions and multiplications.
two_square
Computes a * a and its rounding error: with two_product_fma when HAS_FMA is true, and otherwise with fewer operations than two_product_dekker.
two_sum
Computes a + b and its rounding error (Knuth’s two-sum).