Expand description
This mod re-exports the correct versions of floating-point operations with
unspecified precision in the standard library depending on whether the libm
crate feature is enabled.
All the functions here are named according to their versions in the standard library.
It also provides no_std compatible alternatives to certain floating-point
operations which are not provided in the core library.
Traits§
- Float
Pow - This extension trait covers shortfall in determinacy from the lack of a
libmcounterpart tof32::powi. Use this for the common small exponents.
Functions§
- abs
std - Computes the absolute value of x.
- acos
libm, ornostd-libmand non-std - Computes the arccosine of a number. Return value is in radians in Hyperbolic tangent function.
- acosh
libm, ornostd-libmand non-std - Inverse hyperbolic cosine function.
- asin
libm, ornostd-libmand non-std - Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1].
- asinh
libm, ornostd-libmand non-std - Inverse hyperbolic sine function.
- atan
libm, ornostd-libmand non-std - Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2];
- atan2
libm, ornostd-libmand non-std - Computes the four-quadrant arctangent of
yandxin radians. - atanh
libm, ornostd-libmand non-std - Inverse hyperbolic tangent function.
- cbrt
libm, ornostd-libmand non-std - Returns the cube root of a number.
- ceil
std - Returns the smallest integer greater than or equal to
x. - copysign
std - Returns a number composed of the magnitude of
xand the sign ofy. - cos
libm, ornostd-libmand non-std - Computes the cosine of a number (in radians).
- cosh
libm, ornostd-libmand non-std - Hyperbolic cosine function.
- exp
libm, ornostd-libmand non-std - Returns
e^(self), (the exponential function). - exp2
libm, ornostd-libmand non-std - Returns
2^(self). - exp_m1
libm, ornostd-libmand non-std - Returns
e^(self) - 1in a way that is accurate even if the number is close to zero. - floor
std - Returns the largest integer less than or equal to
x. - fract
std - Returns the fractional part of
x. - hypot
libm, ornostd-libmand non-std - Compute the distance between the origin and a point
(x, y)on the Euclidean plane. - ln
libm, ornostd-libmand non-std - Returns the natural logarithm of the number.
- ln_1p
libm, ornostd-libmand non-std - Returns
ln(1+n)(natural logarithm) more accurately than if the operations were performed separately. - log2
libm, ornostd-libmand non-std - Returns the base 2 logarithm of the number.
- log10
libm, ornostd-libmand non-std - Returns the base 10 logarithm of the number.
- powf
libm, ornostd-libmand non-std - Raises a number to a floating point power.
- rem_
euclid std - Calculates the least nonnegative remainder of
x (mod y). - round
std - Returns the nearest integer to
x. If a value is half-way between two integers, round away from0.0. - sin
libm, ornostd-libmand non-std - Computes the sine of a number (in radians).
- sin_cos
libm, ornostd-libmand non-std - Simultaneously computes the sine and cosine of the number,
x. Returns(sin(x), cos(x)). - sinh
libm, ornostd-libmand non-std - Hyperbolic sine function.
- sqrt
std - Returns the square root of a number.
- tan
libm, ornostd-libmand non-std - Computes the tangent of a number (in radians).
- tanh
libm, ornostd-libmand non-std - Hyperbolic tangent function.