micromath 2.0.0

Embedded-friendly math library featuring fast floating point approximations (with small code size) for common arithmetic operations, trigonometry, 2D/3D vector types, statistical analysis, and quaternions. Optimizes for performance and small code size at the cost of precision.
Documentation
//! Calculate length of the hypotenuse of a right triangle.

use super::F32;

impl F32 {
    /// Calculate the length of the hypotenuse of a right-angle triangle.
    pub fn hypot(self, rhs: Self) -> Self {
        (self * self + rhs * rhs).sqrt()
    }
}

#[cfg(test)]
mod tests {
    use super::F32;

    #[test]
    fn sanity_check() {
        let x = F32(3.0);
        let y = F32(4.0);
        let difference = x.hypot(y) - F32(25.0).sqrt();
        assert!(difference.abs() <= F32::EPSILON);
    }
}