Skip to main content

two_product

Function two_product 

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

Computes a * b and its rounding error with the crate’s selected implementation: two_product_fma when HAS_FMA is true, and two_product_dekker otherwise. Both give equal values.

Requirement: a and b lie in the product domain (see in_product_domain); debug builds panic if they do not.

§Examples

use implicit_predicates_core::eft::two_product;

let a = 1.0 + f64::EPSILON;
let (x, y) = two_product(a, 1.0 - f64::EPSILON);
assert_eq!(x, 1.0);
assert_eq!(y, -f64::EPSILON * f64::EPSILON);