Module std::num
Numeric traits and functions for generic mathematics
These are implemented for the primitive numeric types in std::{u8, u16,
u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}
.
Modules
strconv |
Enums
FPCategory | Used for representing the classification of floating point numbers |
Traits
Bitwise | Numbers with a fixed binary representation. |
Bounded | |
CheckedAdd | Performs addition that returns |
CheckedDiv | Performs division that returns |
CheckedMul | Performs multiplication that returns |
CheckedSub | Performs subtraction that returns |
Float | Operations on primitive floating point numbers. |
FromPrimitive | A generic trait for converting a number to a value. |
FromStrRadix | |
Int | A collection of traits relevant to primitive signed and unsigned integers |
Num | The base trait for numeric types |
NumCast | An interface for casting between machine scalars. |
One | Defines a multiplicative identity element for |
Primitive | Specifies the available operations common to all of Rust's core numeric primitives. These may not always make sense from a purely mathematical point of view, but may be useful for systems programming. |
Round | A collection of rounding operations. |
Saturating | Saturating math operations |
Signed | Useful functions for signed numbers (i.e. numbers that can be negative). |
ToPrimitive | A generic trait for converting a value to a number. |
ToStrRadix | |
Unsigned | |
Zero | Defines an additive identity element for |
Functions
abs | Computes the absolute value. |
abs_sub | The positive difference of two numbers. |
acos | Compute the arccosine of the number. |
acosh | Inverse hyperbolic cosine function. |
asin | Compute the arcsine of the number. |
asinh | Inverse hyperbolic sine function. |
atan | Compute the arctangent of the number. |
atan2 | Compute the arctangent with 2 arguments. |
atanh | Inverse hyperbolic tangent function. |
cast | Cast from one machine scalar to another. |
cbrt | Take the cubic root of a number. |
checked_next_power_of_two | Returns the smallest power of 2 greater than or equal to |
cos | Cosine function. |
cosh | Hyperbolic cosine function. |
div_rem | Simultaneous division and remainder |
exp | Returns |
exp2 | Returns 2 raised to the power of the number, |
exp_m1 | Returns the exponential of the number, minus |
from_f32 | A utility function that just calls |
from_f64 | A utility function that just calls |
from_i16 | A utility function that just calls |
from_i32 | A utility function that just calls |
from_i64 | A utility function that just calls |
from_i8 | A utility function that just calls |
from_int | A utility function that just calls |
from_str_radix | A utility function that just calls FromStrRadix::from_str_radix. |
from_u16 | A utility function that just calls |
from_u32 | A utility function that just calls |
from_u64 | A utility function that just calls |
from_u8 | A utility function that just calls |
from_uint | A utility function that just calls |
hypot | Calculate the length of the hypotenuse of a right-angle triangle given legs
of length |
ln | Returns the natural logarithm of the number. |
ln_1p | Returns the natural logarithm of the number plus |
log | Returns the logarithm of the number with respect to an arbitrary base. |
log10 | Returns the base 10 logarithm of the number. |
log2 | Returns the base 2 logarithm of the number. |
mul_add | Fused multiply-add. Computes |
next_power_of_two | Returns the smallest power of 2 greater than or equal to |
one | Returns the multiplicative identity, |
pow | Raises a value to the power of exp, using exponentiation by squaring. |
powf | Raise a number to a power. |
rsqrt | Take the reciprocal (inverse) square root of a number, |
signum | Returns the sign of the number. |
sin | Sine function. |
sin_cos | Simultaneously computes the sine and cosine of the number. |
sinh | Hyperbolic sine function. |
sqrt | Take the square root of a number. |
tan | Tangent function. |
tanh | Hyperbolic tangent function. |
zero | Returns the additive identity, |