#absolute #generic #value #test

abs

generic absolute value

2 releases

0.1.1 Mar 27, 2022
0.1.0 Mar 24, 2022

#23 in #absolute


Used in rect

MIT license

2KB

Example usage:

#[test]
fn it_works_for_f64_1() {
    assert_ne!(abs(3.1f64, 2.5f64), 0.6f64);
    assert_eq!(abs(3.1f64, 2.5f64), 0.6000000000000001f64);
}

#[test]
fn it_works_for_i32() {
    assert_eq!(abs(42i32, 69i32), 27i32);
}

#[test]
fn it_works_for_u8() {
    assert_eq!(abs(42u8, 69u8), 27u8);
}

No runtime deps