numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation
/// Ceil helper.
///
/// Contract (minimum): round toward positive infinity. Implementers must
/// document behavior for halfway cases (if applicable), NaN/∞ inputs, and
/// whether the result is exact or approximate.
pub trait Ceil: Sized {
    fn ceil(self) -> Self;
}

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

    #[inline]
    fn ceil_f32(x: f32) -> f32 {
        #[cfg(feature = "libm")]
        {
            libm::ceilf(x)
        }
        #[cfg(not(feature = "libm"))]
        {
            f32::ceil(x)
        }
    }

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

    macro_rules! impl_ceil_for_float {
        ($ty:ty, $fn:ident) => {
            impl Ceil for $ty {
                fn ceil(self) -> Self {
                    $fn(self)
                }
            }
        };
    }

    impl_ceil_for_float!(f32, ceil_f32);
    impl_ceil_for_float!(f64, ceil_f64);
}