numaxiom 0.0.2

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

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

    #[inline]
    fn tan_f32(x: f32) -> f32 {
        #[cfg(feature = "libm")]
        {
            libm::tanf(x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f32::tan(x)
        }
    }

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

    macro_rules! impl_tan_for_float {
        ($ty:ty, $fn:ident) => {
            impl Tan for $ty {
                fn tan(self) -> Self {
                    $fn(self)
                }
            }
        };
    }

    impl_tan_for_float!(f32, tan_f32);
    impl_tan_for_float!(f64, tan_f64);
}