Error-Free Transformations (EFT)

The EFT library provides error-free transformations for basic arithmetic operations. These algorithms decompose floating-point operations into a primary result and an error term that exactly represent the mathematical result.

Splitting

fpy2.libraries.eft.veltkamp_split(x, s)

Splits a floating-point number into a high and low part such that the high part is representable in prec(x) - s digits and the low part is representable in s digits.

This algorithm is due to Veltkamp.

Parameters:
  • x (Real) – Value to split

  • s (Real) – Number of low-order digits

Returns:

Tuple of (high_part, low_part)

Return type:

tuple[Real, Real]

Addition

fpy2.libraries.eft.ideal_2sum(a, b)

Error-free transformation of the sum of two floating-point numbers.

Parameters:
  • a (Real) – First operand

  • b (Real) – Second operand

Returns:

Tuple (s, t) where s is the floating-point sum and t is the error term such that s + t = a + b

Return type:

tuple[Real, Real]

This implementation is “ideal” since the error term may not be representable in the caller’s rounding context.

fpy2.libraries.eft.fast_2sum(a, b)

Error-free transformation of the sum of two floating-point numbers. This algorithm is due to Dekker (1971).

Parameters:
  • a (Real) – First operand (must satisfy |a| >= |b|)

  • b (Real) – Second operand

Returns:

Tuple (s, t) where s is the floating-point sum and t is the error term such that s + t = a + b

Return type:

tuple[Real, Real]

Assumes:

  • |a| >= |b|

  • the rounding context is floating point

  • the rounding mode is round-nearest

fpy2.libraries.eft.classic_2sum(a, b)

Computes the sum of two floating-point numbers with error-free transformation. This algorithm is due to Knuth and Moller.

Parameters:
  • a (Real) – First operand

  • b (Real) – Second operand

Returns:

Tuple (s, t) where s is the floating-point sum and t is the error term such that s + t = a + b

Return type:

tuple[Real, Real]

Assumes:

  • the rounding context is floating point

  • the rounding mode is round-nearest

fpy2.libraries.eft.priest_2sum(a, b)

Computes the sum of two floating-point numbers with error-free transformation. This algorithm is due to Priest.

Parameters:
  • a (Real) – First operand

  • b (Real) – Second operand

Returns:

Tuple (s, t) where s is the faithfully-rounded sum and t is the error term such that s + t = a + b

Return type:

tuple[Real, Real]

Assumes:

  • the rounding context is floating point

Multiplication

fpy2.libraries.eft.ideal_2mul(a, b)

Error-free transformation of the product of two floating-point numbers.

Parameters:
  • a (Real) – First operand

  • b (Real) – Second operand

Returns:

Tuple (p, t) where p is the floating-point product and t is the error term such that p + t = a * b

Return type:

tuple[Real, Real]

This implementation is “ideal” since the error term may not be representable in the caller’s rounding context.

fpy2.libraries.eft.classic_2mul(a, b)

Computes the product of two floating-point numbers with error-free transformation. This algorithm is due to Dekker.

Parameters:
  • a (Real) – First operand

  • b (Real) – Second operand

Returns:

Tuple (p, t) where p is the floating-point product and t is the error term such that p + t = a * b

Return type:

tuple[Real, Real]

Assumes:

  • the rounding context is floating point

  • the rounding mode is round-nearest

fpy2.libraries.eft.fast_2mul(a, b)

Error-free transformation of the product of two floating-point numbers.

Parameters:
  • a (Real) – First operand

  • b (Real) – Second operand

Returns:

Tuple (p, t) where p is the floating-point product and t is the error term such that p + t = a * b

Return type:

tuple[Real, Real]

Assumes:

  • the rounding context is floating point

Fused Multiply-Add (FMA)

fpy2.libraries.eft.ideal_fma(a, b, c)

Error-free transformation of the fused multiply-add operation.

Parameters:
  • a (Real) – First multiplicand

  • b (Real) – Second multiplicand

  • c (Real) – Addend

Returns:

Tuple (r, t) where r is the floating-point result and t is the error term such that r + t = a * b + c

Return type:

tuple[Real, Real]

This implementation is “ideal” since the error term may not be representable in the caller’s rounding context.

fpy2.libraries.eft.classic_2fma(a, b, c)

Computes the fused multiply-add operation with error-free transformation. This algorithm is due to Boldo and Muller.

Parameters:
  • a (Real) – First multiplicand

  • b (Real) – Second multiplicand

  • c (Real) – Addend

Returns:

Tuple (r1, r2, r3) where a * b + c = r1 + r2 + r3

Return type:

tuple[Real, Real, Real]

Assumes:

  • the rounding context is floating point

  • the rounding mode is round-nearest