micromath 2.1.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
//! Fused multiply-add. Computes `(self * a) + b`

use super::F32;

impl F32 {
    /// Computes `(self * a) + b`.
    pub fn mul_add(self, a: Self, b: Self) -> Self {
        self * a + b
    }
}

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

    #[test]
    fn sanity_check() {
        assert_eq!(F32(0.0).mul_add(F32(0.0), F32(1.0)), F32(1.0));
        assert_eq!(F32(1.0).mul_add(F32(2.0), F32(3.5)), F32(5.5));
        assert_eq!(F32(1.0).mul_add(F32(-1.0), F32(0.0)), F32(-1.0));
    }
}