numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation
/// Base-10 logarithm helper.
pub trait Log10: Sized {
    fn log10(self) -> Self;
}

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

    fn log10_f32(x: f32) -> f32 {
        #[cfg(feature = "libm")]
        {
            libm::log10f(x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f32::log10(x)
        }
    }

    fn log10_f64(x: f64) -> f64 {
        #[cfg(feature = "libm")]
        {
            libm::log10(x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f64::log10(x)
        }
    }

    macro_rules! impl_log10_for_float {
        ($ty:ty, $fn:ident) => {
            impl Log10 for $ty {
                fn log10(self) -> Self {
                    $fn(self)
                }
            }
        };
    }

    impl_log10_for_float!(f32, log10_f32);
    impl_log10_for_float!(f64, log10_f64);
}