Skip to main content

fast_two_sum

Function fast_two_sum 

Source
pub fn fast_two_sum(a: f64, b: f64) -> (f64, f64)
Expand description

As two_sum in 3 flops, requires |a| ≥ |b| or a = 0 (Dekker’s Fast2Sum); the requirement is a debug_assert!.

Precisely, the algorithm is exact whenever the exponent of a is at least that of b (Algorithm F of Chapter 11.1), and that — the weaker condition, which |a| ≥ |b| implies — is what the assertion tests.