Skip to main content

square

Function square 

Source
pub fn square<T>(value: T) -> Square<T>
Expand description

Wraps a value for use in the apfp_signum! macro to compute its square.

ยงExample

use apfp::{apfp_signum, square};

let x = 3.0_f64;
let y = 2.0_f64;
// Compute sign of x^2 - y^2
let sign = apfp_signum!(square(x) - square(y));
assert_eq!(sign, 1); // 9 - 4 = 5 > 0