numaxiom 0.0.2

Lightweight numeric marker traits for ranges/signs plus constants and ops; std by default, no_std optional.
Documentation

numaxiom

CI Crates.io Docs.rs no_std MSRV License: MIT OR Apache-2.0

⚠️ 0.0.x is pre-release/experimental; breaking changes are expected. See VERSIONS.md for status and compatibility details.

Numeric marker traits for ranges, signs, constants, and lightweight operations, usable in std and no_std environments. Not a num-traits shim: contracts are explicit, implementations document any variability (NaN/∞/rounding/panic).

What’s included

  • Contracts: Positive, Negative, NonPositive, NonNegative, AnySign, NonZero; domain markers NonNan / HasNan / NanConst; infinity markers (HasPositiveInfinity, HasNegativeInfinity, HasAnySignInfinity and Non* variants).
  • Constants: Zero / One / Two (+ Has*, Non*, *Const), MinValue / MaxValue (+ const/marker), Epsilon (+ const/marker).
  • Operations: Abs, Signum, Reciprocal, Sqrt, Root, Pow, Cbrt, Hypot, Exp, Log / Log2 / Log10 / LogBase, rounding (Floor / Ceil / Round / Trunc), trig (Sin / Cos / Tan + Asin / Acos / Atan / Atan2), Clamp, checked and saturating math.

Features & platform notes

  • Default features: std. Works with no_std by disabling default features.
  • Optional: libm for no_std float math symbols (opt-in; see ARCHITECTURE.md for details). Float ops are implemented for f32/f64 only when std or libm is enabled. Enabling libm inherits libm's MSRV (currently Rust 1.63 for 0.2.x; future libm releases may raise this).
  • Implementers must document domain/exception behavior for ops that can vary (NaN/∞/panic/rounding/overflow).

Example

use core::ops::Add;
use numaxiom::{Abs, Clamp, NonNegative, One, Two, Zero};

fn normalize<T>(value: T) -> T
where
    T: NonNegative + Abs + One + Two + Zero + Clamp + Add<Output = T>,
{
    let denom = T::one() + T::two();
    value.abs().clamp(T::zero(), denom)
}

More

License

Dual-licensed under MIT OR Apache-2.0. See the bundled license files.