Skip to main content

Module math

Module math 

Source
Expand description

Platform-agnostic f64 math operations.

In std mode, these delegate to inherent f64 methods (zero overhead). In no_std mode, these use libm (pure Rust software implementations).

This module exists because f64 inherent methods (.sqrt(), .exp(), etc.) are not available in no_std on MSRV 1.75.

Functions§

abs
Absolute value.
abs_f32
f32 absolute value.
ceil
Ceil.
cos
Cosine.
erf
Error function.
exp
Natural exponential (e^x).
floor
Floor.
fmax
Maximum of two f64 values (handles NaN: returns the non-NaN value).
fmin
Minimum of two f64 values (handles NaN: returns the non-NaN value).
ln
Natural logarithm (ln).
log2
Base-2 logarithm.
log10
Base-10 logarithm.
powf
Power: x^n (floating point exponent).
powi
Power: x^n (integer exponent).
round
Round to nearest integer.
sin
Sine.
sqrt
Square root.
sqrt_f32
f32 square root.
tanh
Hyperbolic tangent.