Skip to main content

Module math

Module math 

Source
Expand description

Math functions for no_std compatibility.

In no_std mode, f64 doesn’t have transcendental methods like sqrt, ln, cos, etc. This module provides these functions using libm.

Functions§

abs
Absolute value.
cbrt
Cube root.
ceil
Ceiling (round up).
cos
Cosine.
exp
Exponential (e^x).
floor
Floor (round down).
ln
Natural logarithm.
log10
Base-10 logarithm.
normal_cdf
Standard normal CDF: Φ(x) = (1 + erf(x/√2)) / 2
pow
Power (x^y).
round
Round to nearest integer.
sq
Square (x^2).
sqrt
Square root.