numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation
/// Two-argument arctangent helper.
///
/// Contract (minimum): return the angle of the vector (`self`, `other`) in the
/// range and convention chosen by the implementation. Implementers must
/// document quadrant rules, handling of zeros/NaN/∞, and accuracy guarantees.
pub trait Atan2: Sized {
    fn atan2(self, other: Self) -> Self;
}

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

    #[inline]
    fn atan2_f32(y: f32, x: f32) -> f32 {
        #[cfg(feature = "libm")]
        {
            libm::atan2f(y, x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f32::atan2(y, x)
        }
    }

    #[inline]
    fn atan2_f64(y: f64, x: f64) -> f64 {
        #[cfg(feature = "libm")]
        {
            libm::atan2(y, x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f64::atan2(y, x)
        }
    }

    macro_rules! impl_atan2_for_float {
        ($ty:ty, $fn:ident) => {
            impl Atan2 for $ty {
                fn atan2(self, other: Self) -> Self {
                    $fn(self, other)
                }
            }
        };
    }

    impl_atan2_for_float!(f32, atan2_f32);
    impl_atan2_for_float!(f64, atan2_f64);
}