stkcraft-time 0.2.0

NAIF/SPICE-aligned astronomical time scales in Rust: UTC, TAI, TT, TDB/ET, GPS, UT1 and SCLK, with LSK/SCLK/EOP kernels, no_std support, WebGeocalc parity and an MCP server.
Documentation
//! Floating-point helpers that work with and without `std`.
//!
//! With the `std` feature (the default) the standard library methods are
//! used. Without it, the same operations come from `libm`.

#[cfg(feature = "std")]
pub(crate) fn cos(x: f64) -> f64 {
    x.cos()
}
#[cfg(not(feature = "std"))]
pub(crate) fn cos(x: f64) -> f64 {
    libm::cos(x)
}

#[cfg(feature = "std")]
pub(crate) fn sin(x: f64) -> f64 {
    x.sin()
}
#[cfg(not(feature = "std"))]
pub(crate) fn sin(x: f64) -> f64 {
    libm::sin(x)
}

#[cfg(feature = "std")]
pub(crate) fn floor(x: f64) -> f64 {
    x.floor()
}
#[cfg(not(feature = "std"))]
pub(crate) fn floor(x: f64) -> f64 {
    libm::floor(x)
}

#[cfg(feature = "std")]
pub(crate) fn round(x: f64) -> f64 {
    x.round()
}
#[cfg(not(feature = "std"))]
pub(crate) fn round(x: f64) -> f64 {
    libm::round(x)
}

#[cfg(feature = "std")]
pub(crate) fn ln(x: f64) -> f64 {
    x.ln()
}
#[cfg(not(feature = "std"))]
pub(crate) fn ln(x: f64) -> f64 {
    libm::log(x)
}

pub(crate) fn abs(x: f64) -> f64 {
    if x < 0.0 {
        -x
    } else {
        x
    }
}

pub(crate) fn to_radians(degrees: f64) -> f64 {
    degrees * core::f64::consts::PI / 180.0
}