Expand description
Floating-point primitives routed to std or libm.
Routing every transcendental call through this module lets the crate build
as no_std: with default-features = false, features = ["libm"] the same
code links against pure-Rust libm.
Public because the rule applies to the whole crate family: magnetic models and estimators call these and thereby build for bare metal and produce the same results on every target. Also provides the conversions and guarded casts numeric code needs.
Constants§
- RELATIVE_
TOLERANCE - Relative tolerance for comparing computed results.
Functions§
- abs
- Absolute value.
- acos
- Arccosine in
[0, π];NaNoutside[-1, 1]. - asin
- Arcsine in
[-π/2, π/2];NaNoutside[-1, 1]. - atan
- Arctangent in
[-π/2, π/2]. - atan2
- Four-quadrant arctangent of
y / x, in[-π, π]. - ceil
- Ceiling.
- copysign
magnitudewith the sign ofsign.- cos
- Cosine, radians.
- count_
to_ f64 - Count as
f64. Counts here are far below 2^53, so the conversion is exact. - exp
eˣ.- hypot
√(x² + y²)without intermediate overflow.- is_
effectively_ zero - Whether a value is zero relative to
scale, the magnitude of its operands. - is_
integral - Whether a value is an integer.
- ln
- Natural logarithm;
NaNfor negative input,-∞for zero. - round
- Round to nearest, halves away from zero.
- round_
to_ i32 - Rounds a value known to be within
i32range. Callers pass angles bounded by 360. - sin
- Sine, radians.
- sqrt
- Square root;
NaNfor negative input. - tan
- Tangent, radians.
- to_
degrees - Radians to degrees.
- to_
radians - Degrees to radians.
- to_
usize - Truncates a small non-negative value to
usize. Callers bound it first; out-of-range input yields zero. - trunc
- Truncate towards zero.