Skip to main content

two_square

Function two_square 

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

Computes a * a and its rounding error: with two_product_fma when HAS_FMA is true, and otherwise with fewer operations than two_product_dekker.

Requirement: a lies in the product domain (see in_product_domain); debug builds panic if it does not.

ยงExamples

use implicit_predicates_core::eft::two_square;

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