numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation
/// Sine helper.
///
/// Contract (minimum): return the sine of the input. Implementers must document
/// behavior for NaN/∞ inputs and any accuracy guarantees.
pub trait Sin: Sized {
    fn sin(self) -> Self;
}

#[cfg(any(feature = "std", feature = "libm"))]
mod float_impls {
    use super::Sin;

    #[inline]
    fn sin_f32(x: f32) -> f32 {
        #[cfg(feature = "libm")]
        {
            libm::sinf(x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f32::sin(x)
        }
    }

    #[inline]
    fn sin_f64(x: f64) -> f64 {
        #[cfg(feature = "libm")]
        {
            libm::sin(x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f64::sin(x)
        }
    }

    macro_rules! impl_sin_for_float {
        ($ty:ty, $fn:ident) => {
            impl Sin for $ty {
                fn sin(self) -> Self {
                    $fn(self)
                }
            }
        };
    }

    impl_sin_for_float!(f32, sin_f32);
    impl_sin_for_float!(f64, sin_f64);
}