[src]

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}.

strconv
FPCategory

Used for representing the classification of floating point numbers

Bitwise

Numbers with a fixed binary representation.

Bounded
CheckedAdd

Performs addition that returns None instead of wrapping around on overflow.

CheckedDiv

Performs division that returns None instead of wrapping around on underflow or overflow.

CheckedMul

Performs multiplication that returns None instead of wrapping around on underflow or overflow.

CheckedSub

Performs subtraction that returns None instead of wrapping around on underflow.

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 Self.

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 Self.

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 n. If the next power of two is greater than the type's maximum value, None is returned, otherwise the power of 2 is wrapped in Some.

cos

Cosine function.

cosh

Hyperbolic cosine function.

div_rem

Simultaneous division and remainder

exp

Returns e^(value), (the exponential function).

exp2

Returns 2 raised to the power of the number, 2^(value).

exp_m1

Returns the exponential of the number, minus 1, exp(n) - 1, in a way that is accurate even if the number is close to zero.

from_f32

A utility function that just calls FromPrimitive::from_f32.

from_f64

A utility function that just calls FromPrimitive::from_f64.

from_i16

A utility function that just calls FromPrimitive::from_i16.

from_i32

A utility function that just calls FromPrimitive::from_i32.

from_i64

A utility function that just calls FromPrimitive::from_i64.

from_i8

A utility function that just calls FromPrimitive::from_i8.

from_int

A utility function that just calls FromPrimitive::from_int.

from_str_radix

A utility function that just calls FromStrRadix::from_str_radix.

from_u16

A utility function that just calls FromPrimitive::from_u16.

from_u32

A utility function that just calls FromPrimitive::from_u32.

from_u64

A utility function that just calls FromPrimitive::from_u64.

from_u8

A utility function that just calls FromPrimitive::from_u8.

from_uint

A utility function that just calls FromPrimitive::from_uint.

hypot

Calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y.

ln

Returns the natural logarithm of the number.

ln_1p

Returns the natural logarithm of the number plus 1, ln(n + 1), more accurately than if the operations were performed separately.

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 (a * b) + c with only one rounding error.

next_power_of_two

Returns the smallest power of 2 greater than or equal to n.

one

Returns the multiplicative identity, 1.

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, 1/sqrt(x).

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, 0.