Expand description
Tiny f64 math facade that works on both the default (std)
build and the no_std opt-in. core::f64 doesn’t expose
sqrt / sin / cos / etc. — those methods live in
std::f64’s platform-dependent math library — so the no_std
build has to forward to the pure-Rust libm crate instead.
The std build stays dep-free and calls the native f64
methods directly.
Every bop math builtin and ops::div / ops::rem’s float
path goes through here rather than calling x.sqrt() /
libm::sqrt(x) at the point of use, so the rest of the
codebase stays #[cfg]-free.
§Feature
The only math-related feature is no_std. Leave it off (the
default) to get std::f64’s native math with no external
deps. Enable it — with default-features = false, features = ["no_std"] — when targeting bare-metal / embedded / edge
wasm. no_std pulls in the tiny pure-Rust libm crate.
Functions§
- ceil
⌈x⌉— smallest integer ≥ x, as a float.- cos
cos(x)(radians).- exp
e^x.- floor
⌊x⌋— largest integer ≤ x, as a float.- ln
- Natural log.
- powf
base ** expfor floats.- round
- Round half-away-from-zero (matches
f64::round). - sin
sin(x)(radians).- sqrt
√x.- tan
tan(x)(radians).- trunc
- Truncate toward zero — drop the fractional part.