uxarray.grid.utils._fmms#

uxarray.grid.utils._fmms(a, b, c, d)#

Calculate the difference of products using the FMA (fused multiply-add) operation: (a * b) - (c * d).

This operation leverages the fused multiply-add operation when available on the system and rounds the result only once. The relative error of this operation is bounded by 1.5 ulps when no overflow and underflow occur.

Parameters
  • (float) (d) –

  • (float)

  • (float)

  • (float)

Returns

float

Return type

The difference of the two products.

Example

>>> _fmms(3.0,2.0,1.0,1.0)
5.0

Claude-Pierre Jeannerod, Nicolas Louvet, and Jean-Michel Muller, Further analysis of Kahan’s algorithm for the accurate computation of 2 x 2 determinants, Mathematics of Computation, vol. 82, no. 284, pp. 2245-2264, 2013. [Read more](https://ens-lyon.hal.science/ensl-00649347) (DOI: 10.1090/S0025-5718-2013-02679-8)