[go: up one dir, main page]

ultraviolet 0.3.3-alpha1

A crate to do linear algebra, fast.
Documentation
use wide::f32x4;

pub trait EqualsEps {
    fn eq_eps(self, other: Self) -> bool;
}

impl EqualsEps for f32x4 {
    fn eq_eps(self, other: Self) -> bool {
        let r = (self - other).abs();
        for eps in r.as_ref().iter() {
            if *eps > 0.01 {
                return false;
            }
        }
        true
    }
}

impl EqualsEps for f32 {
    fn eq_eps(self, other: Self) -> bool {
        (self - other).abs() <= 0.01
    }
}