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

Computes a + b and its rounding error, faster than two_sum when the magnitudes are known to be ordered (Dekker’s fast-two-sum).

Requirement: |a| >= |b| or a == 0, and a + b does not overflow.

§Examples

use implicit_predicates_core::eft::fast_two_sum;

let (x, y) = fast_two_sum(1.0, 1e-20);
assert_eq!(x, 1.0);
assert_eq!(y, 1e-20);