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

Algebraic
BitCount
Bitwise

Collects the bitwise operators under one trait.

Bounded
CheckedAdd
CheckedDiv
CheckedMul
CheckedSub
Exponential
Float

Primitive floating point numbers

Fractional
FromStrRadix
Hyperbolic
Int

A collection of traits relevant to primitive signed and unsigned integers

IntConvertible
Integer
Num

The base trait for numeric types

NumCast

An interface for casting between machine scalars

One
Orderable
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.

Real

Defines constants and methods common to real numbers

RealExt

Methods that are harder to implement and not commonly used.

Round
Saturating

Saturating math operations

Signed
Times

Times trait

ToStrRadix
Trigonometric
Unsigned
Zero

Functions

abs
abs_sub
acos
acosh
asin
asinh
atan
atan2
atanh
cast

Cast from one machine scalar to another

cbrt
clamp
cos
cosh
exp
exp2
exp_m1
from_str_radix

A utility function that just calls FromStrRadix::from_str_radix

gcd
hypot
lcm
ln
ln_1p
log
log10
log2
max
min
mul_add
one
pow
pow_with_uint

Calculates a power to a given radix, optimized for uint pow and radix.

rsqrt
signum
sin
sin_cos
sinh
sqrt
tan
tanh
zero