uxarray.utils.computing.two_prod

Contents

uxarray.utils.computing.two_prod#

uxarray.utils.computing.two_prod(a, b)#

Dekker TwoProd: return (p, e) with p = fl(a*b) and p + e = a*b exactly.

Uses a single fused multiply-add for the error term on hardware that supports it (selected at import time via _HAS_FMA), falling back to the portable Veltkamp split otherwise. The FMA path is ~2x faster in the compensated geometry kernels and is bit-for-bit identical to the Veltkamp result (validated at import).

Parameters:
  • a (float) – Input values.

  • b (float) – Input values.

Returns:

  • p (float) – Rounded product fl(a * b).

  • e (float) – Rounding error term; p + e = a * b exactly.

References

Dekker, T. J. (1971). A floating-point technique for extending the available precision. Numerische Mathematik, 18, 224-242. https://doi.org/10.1007/BF01397083