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

Enum FPCategory

Used for representing the classification of floating point numbers

Variants

Trait Algebraic

Method pow

fn pow(&self, n: &Self) -> Self

Method sqrt

fn sqrt(&self) -> Self

Method rsqrt

fn rsqrt(&self) -> Self

Method cbrt

fn cbrt(&self) -> Self

Method hypot

fn hypot(&self, other: &Self) -> Self

Trait BitCount

Method population_count

fn population_count(&self) -> Self

Method leading_zeros

fn leading_zeros(&self) -> Self

Method trailing_zeros

fn trailing_zeros(&self) -> Self

Trait Bitwise

Collects the bitwise operators under one trait.

Trait Bounded

Method min_value

fn min_value() -> Self

Method max_value

fn max_value() -> Self

Trait CheckedAdd

Method checked_add

fn checked_add(&self, v: &Self) -> Option<Self>

Trait CheckedDiv

Method checked_div

fn checked_div(&self, v: &Self) -> Option<Self>

Trait CheckedMul

Method checked_mul

fn checked_mul(&self, v: &Self) -> Option<Self>

Trait CheckedSub

Method checked_sub

fn checked_sub(&self, v: &Self) -> Option<Self>

Trait Exponential

Method exp

fn exp(&self) -> Self

Method exp2

fn exp2(&self) -> Self

Method ln

fn ln(&self) -> Self

Method log

fn log(&self, base: &Self) -> Self

Method log2

fn log2(&self) -> Self

Method log10

fn log10(&self) -> Self

Trait Float

Primitive floating point numbers

Method NaN

fn NaN() -> Self

Method infinity

fn infinity() -> Self

Method neg_infinity

fn neg_infinity() -> Self

Method neg_zero

fn neg_zero() -> Self

Method is_NaN

fn is_NaN(&self) -> bool

Method is_infinite

fn is_infinite(&self) -> bool

Method is_finite

fn is_finite(&self) -> bool

Method is_normal

fn is_normal(&self) -> bool

Method classify

fn classify(&self) -> FPCategory

Method mantissa_digits

fn mantissa_digits(unused_self: Option<Self>) -> uint

Method digits

fn digits(unused_self: Option<Self>) -> uint

Method epsilon

fn epsilon() -> Self

Method min_exp

fn min_exp(unused_self: Option<Self>) -> int

Method max_exp

fn max_exp(unused_self: Option<Self>) -> int

Method min_10_exp

fn min_10_exp(unused_self: Option<Self>) -> int

Method max_10_exp

fn max_10_exp(unused_self: Option<Self>) -> int

Method ldexp

fn ldexp(x: Self, exp: int) -> Self

Method frexp

fn frexp(&self) -> (Self, int)

Method exp_m1

fn exp_m1(&self) -> Self

Method ln_1p

fn ln_1p(&self) -> Self

Method mul_add

fn mul_add(&self, a: Self, b: Self) -> Self

Method next_after

fn next_after(&self, other: Self) -> Self

Trait Fractional

Method recip

fn recip(&self) -> Self

Trait FromStrRadix

Method from_str_radix

fn from_str_radix(str: &str, radix: uint) -> Option<Self>

Trait Hyperbolic

Method sinh

fn sinh(&self) -> Self

Method cosh

fn cosh(&self) -> Self

Method tanh

fn tanh(&self) -> Self

Method asinh

fn asinh(&self) -> Self

Method acosh

fn acosh(&self) -> Self

Method atanh

fn atanh(&self) -> Self

Trait Int

A collection of traits relevant to primitive signed and unsigned integers

Trait IntConvertible

Method to_int

fn to_int(&self) -> int

Method from_int

fn from_int(n: int) -> Self

Trait Integer

Method div_rem

fn div_rem(&self, other: &Self) -> (Self, Self)

Method div_floor

fn div_floor(&self, other: &Self) -> Self

Method mod_floor

fn mod_floor(&self, other: &Self) -> Self

Method div_mod_floor

fn div_mod_floor(&self, other: &Self) -> (Self, Self)

Method gcd

fn gcd(&self, other: &Self) -> Self

Method lcm

fn lcm(&self, other: &Self) -> Self

Method is_multiple_of

fn is_multiple_of(&self, other: &Self) -> bool

Method is_even

fn is_even(&self) -> bool

Method is_odd

fn is_odd(&self) -> bool

Trait Num

The base trait for numeric types

Trait NumCast

An interface for casting between machine scalars

Method from

fn from<T: NumCast>(n: T) -> Self

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Trait One

Method one

fn one() -> Self

Trait Orderable

Method min

fn min(&self, other: &Self) -> Self

Method max

fn max(&self, other: &Self) -> Self

Method clamp

fn clamp(&self, mn: &Self, mx: &Self) -> Self

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

Method bits

fn bits(unused_self: Option<Self>) -> uint

Method bytes

fn bytes(unused_self: Option<Self>) -> uint

Trait Real

Defines constants and methods common to real numbers

Method pi

fn pi() -> Self

Method two_pi

fn two_pi() -> Self

Method frac_pi_2

fn frac_pi_2() -> Self

Method frac_pi_3

fn frac_pi_3() -> Self

Method frac_pi_4

fn frac_pi_4() -> Self

Method frac_pi_6

fn frac_pi_6() -> Self

Method frac_pi_8

fn frac_pi_8() -> Self

Method frac_1_pi

fn frac_1_pi() -> Self

Method frac_2_pi

fn frac_2_pi() -> Self

Method frac_2_sqrtpi

fn frac_2_sqrtpi() -> Self

Method sqrt2

fn sqrt2() -> Self

Method frac_1_sqrt2

fn frac_1_sqrt2() -> Self

Method e

fn e() -> Self

Method log2_e

fn log2_e() -> Self

Method log10_e

fn log10_e() -> Self

Method ln_2

fn ln_2() -> Self

Method ln_10

fn ln_10() -> Self

Method to_degrees

fn to_degrees(&self) -> Self

Method to_radians

fn to_radians(&self) -> Self

Trait RealExt

Methods that are harder to implement and not commonly used.

Method lgamma

fn lgamma(&self) -> (int, Self)

Method tgamma

fn tgamma(&self) -> Self

Method j0

fn j0(&self) -> Self

Method j1

fn j1(&self) -> Self

Method jn

fn jn(&self, n: int) -> Self

Method y0

fn y0(&self) -> Self

Method y1

fn y1(&self) -> Self

Method yn

fn yn(&self, n: int) -> Self

Trait Round

Method floor

fn floor(&self) -> Self

Method ceil

fn ceil(&self) -> Self

Method round

fn round(&self) -> Self

Method trunc

fn trunc(&self) -> Self

Method fract

fn fract(&self) -> Self

Trait Saturating

Saturating math operations

Method saturating_add

fn saturating_add(self, v: Self) -> Self

Saturating addition operator. Returns a+b, saturating at the numeric bounds instead of overflowing.

Method saturating_sub

fn saturating_sub(self, v: Self) -> Self

Saturating subtraction operator. Returns a-b, saturating at the numeric bounds instead of overflowing.

Trait Signed

Method abs

fn abs(&self) -> Self

Method abs_sub

fn abs_sub(&self, other: &Self) -> Self

Method signum

fn signum(&self) -> Self

Method is_positive

fn is_positive(&self) -> bool

Method is_negative

fn is_negative(&self) -> bool

Trait Times

Times trait

use num::Times;
let ten = 10 as uint;
let mut accum = 0;
do ten.times { accum += 1; }

Method times

fn times(&self, it: &fn())

Trait ToStrRadix

Method to_str_radix

fn to_str_radix(&self, radix: uint) -> ~str

Trait Trigonometric

Method sin

fn sin(&self) -> Self

Method cos

fn cos(&self) -> Self

Method tan

fn tan(&self) -> Self

Method asin

fn asin(&self) -> Self

Method acos

fn acos(&self) -> Self

Method atan

fn atan(&self) -> Self

Method atan2

fn atan2(&self, other: &Self) -> Self

Method sin_cos

fn sin_cos(&self) -> (Self, Self)

Trait Unsigned

Trait Zero

Method zero

fn zero() -> Self

Method is_zero

fn is_zero(&self) -> bool

Implementation of ::std::cmp::Eq for FPCategory

Automatically derived.

Method eq

fn eq(&self, __arg_0: &FPCategory) -> ::bool

Method ne

fn ne(&self, __arg_0: &FPCategory) -> ::bool

Implementation of NumCast for u8

Method from

fn from<N: NumCast>(n: N) -> u8

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for u16

Method from

fn from<N: NumCast>(n: N) -> u16

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for u32

Method from

fn from<N: NumCast>(n: N) -> u32

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for u64

Method from

fn from<N: NumCast>(n: N) -> u64

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for uint

Method from

fn from<N: NumCast>(n: N) -> uint

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for i8

Method from

fn from<N: NumCast>(n: N) -> i8

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for i16

Method from

fn from<N: NumCast>(n: N) -> i16

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for i32

Method from

fn from<N: NumCast>(n: N) -> i32

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for i64

Method from

fn from<N: NumCast>(n: N) -> i64

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for int

Method from

fn from<N: NumCast>(n: N) -> int

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for f32

Method from

fn from<N: NumCast>(n: N) -> f32

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for f64

Method from

fn from<N: NumCast>(n: N) -> f64

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of NumCast for float

Method from

fn from<N: NumCast>(n: N) -> float

Method to_u8

fn to_u8(&self) -> u8

Method to_u16

fn to_u16(&self) -> u16

Method to_u32

fn to_u32(&self) -> u32

Method to_u64

fn to_u64(&self) -> u64

Method to_uint

fn to_uint(&self) -> uint

Method to_i8

fn to_i8(&self) -> i8

Method to_i16

fn to_i16(&self) -> i16

Method to_i32

fn to_i32(&self) -> i32

Method to_i64

fn to_i64(&self) -> i64

Method to_int

fn to_int(&self) -> int

Method to_f32

fn to_f32(&self) -> f32

Method to_f64

fn to_f64(&self) -> f64

Method to_float

fn to_float(&self) -> float

Implementation of Zero for @mut T where <T: Zero + 'static>

Method zero

fn zero() -> @mut T

Method is_zero

fn is_zero(&self) -> bool

Implementation of Zero for @T where <T: Zero + 'static>

Method zero

fn zero() -> @T

Method is_zero

fn is_zero(&self) -> bool

Implementation of Zero for ~T where <T: Zero>

Method zero

fn zero() -> ~T

Method is_zero

fn is_zero(&self) -> bool

Implementation of Saturating for T where <T: CheckedAdd + CheckedSub + Zero + Ord + Bounded>

Method saturating_add

fn saturating_add(self, v: T) -> T

Method saturating_sub

fn saturating_sub(self, v: T) -> T

Implementation of CheckedAdd for i8

Method checked_add

fn checked_add(&self, v: &i8) -> Option<i8>

Implementation of CheckedAdd for i16

Method checked_add

fn checked_add(&self, v: &i16) -> Option<i16>

Implementation of CheckedAdd for i32

Method checked_add

fn checked_add(&self, v: &i32) -> Option<i32>

Implementation of CheckedAdd for i64

Method checked_add

fn checked_add(&self, v: &i64) -> Option<i64>

Implementation of CheckedAdd for int

Method checked_add

fn checked_add(&self, v: &int) -> Option<int>

Implementation of CheckedAdd for u8

Method checked_add

fn checked_add(&self, v: &u8) -> Option<u8>

Implementation of CheckedAdd for u16

Method checked_add

fn checked_add(&self, v: &u16) -> Option<u16>

Implementation of CheckedAdd for u32

Method checked_add

fn checked_add(&self, v: &u32) -> Option<u32>

Implementation of CheckedAdd for u64

Method checked_add

fn checked_add(&self, v: &u64) -> Option<u64>

Implementation of CheckedAdd for uint

Method checked_add

fn checked_add(&self, v: &uint) -> Option<uint>

Implementation of CheckedSub for i8

Method checked_sub

fn checked_sub(&self, v: &i8) -> Option<i8>

Implementation of CheckedSub for i16

Method checked_sub

fn checked_sub(&self, v: &i16) -> Option<i16>

Implementation of CheckedSub for i32

Method checked_sub

fn checked_sub(&self, v: &i32) -> Option<i32>

Implementation of CheckedSub for i64

Method checked_sub

fn checked_sub(&self, v: &i64) -> Option<i64>

Implementation of CheckedSub for int

Method checked_sub

fn checked_sub(&self, v: &int) -> Option<int>

Implementation of CheckedSub for u8

Method checked_sub

fn checked_sub(&self, v: &u8) -> Option<u8>

Implementation of CheckedSub for u16

Method checked_sub

fn checked_sub(&self, v: &u16) -> Option<u16>

Implementation of CheckedSub for u32

Method checked_sub

fn checked_sub(&self, v: &u32) -> Option<u32>

Implementation of CheckedSub for u64

Method checked_sub

fn checked_sub(&self, v: &u64) -> Option<u64>

Implementation of CheckedSub for uint

Method checked_sub

fn checked_sub(&self, v: &uint) -> Option<uint>

Implementation of CheckedMul for i8

Method checked_mul

fn checked_mul(&self, v: &i8) -> Option<i8>

Implementation of CheckedMul for i16

Method checked_mul

fn checked_mul(&self, v: &i16) -> Option<i16>

Implementation of CheckedMul for i32

Method checked_mul

fn checked_mul(&self, v: &i32) -> Option<i32>

Implementation of CheckedMul for int

Method checked_mul

fn checked_mul(&self, v: &int) -> Option<int>

Implementation of CheckedMul for u8

Method checked_mul

fn checked_mul(&self, v: &u8) -> Option<u8>

Implementation of CheckedMul for u16

Method checked_mul

fn checked_mul(&self, v: &u16) -> Option<u16>

Implementation of CheckedMul for u32

Method checked_mul

fn checked_mul(&self, v: &u32) -> Option<u32>

Implementation of CheckedMul for uint

Method checked_mul

fn checked_mul(&self, v: &uint) -> Option<uint>

Function abs

fn abs<T: Signed>(value: T) -> T

Function abs_sub

fn abs_sub<T: Signed>(x: T, y: T) -> T

Function acos

fn acos<T: Trigonometric>(value: T) -> T

Function acosh

fn acosh<T: Hyperbolic>(value: T) -> T

Function asin

fn asin<T: Trigonometric>(value: T) -> T

Function asinh

fn asinh<T: Hyperbolic>(value: T) -> T

Function atan

fn atan<T: Trigonometric>(value: T) -> T

Function atan2

fn atan2<T: Trigonometric>(x: T, y: T) -> T

Function atanh

fn atanh<T: Hyperbolic>(value: T) -> T

Function cast

fn cast<T: NumCast, U: NumCast>(n: T) -> U

Cast from one machine scalar to another

Example

let twenty: f32 = num::cast(0x14);
assert_eq!(twenty, 20f32);

Function cbrt

fn cbrt<T: Algebraic>(value: T) -> T

Function clamp

fn clamp<T: Orderable>(value: T, mn: T, mx: T) -> T

Function cos

fn cos<T: Trigonometric>(value: T) -> T

Function cosh

fn cosh<T: Hyperbolic>(value: T) -> T

Function exp

fn exp<T: Exponential>(value: T) -> T

Function exp2

fn exp2<T: Exponential>(value: T) -> T

Function exp_m1

fn exp_m1<T: Float>(value: T) -> T

Function gcd

fn gcd<T: Integer>(x: T, y: T) -> T

Function hypot

fn hypot<T: Algebraic>(x: T, y: T) -> T

Function lcm

fn lcm<T: Integer>(x: T, y: T) -> T

Function ln

fn ln<T: Exponential>(value: T) -> T

Function ln_1p

fn ln_1p<T: Float>(value: T) -> T

Function log

fn log<T: Exponential>(value: T, base: T) -> T

Function log10

fn log10<T: Exponential>(value: T) -> T

Function log2

fn log2<T: Exponential>(value: T) -> T

Function max

fn max<T: Orderable>(x: T, y: T) -> T

Function min

fn min<T: Orderable>(x: T, y: T) -> T

Function mul_add

fn mul_add<T: Float>(a: T, b: T, c: T) -> T

Function one

fn one<T: One>() -> T

Function pow

fn pow<T: Algebraic>(value: T, n: T) -> T

Function pow_with_uint

fn pow_with_uint<T: NumCast + One + Zero + Div<T, T> +
                 Mul<T, T>>(radix: uint, pow: uint) -> T

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

Returns radix^pow as T.

Note: Also returns 1 for 0^0, despite that technically being an undefined number. The reason for this is twofold: - If code written to use this function cares about that special case, it's probably going to catch it before making the call. - If code written to use this function doesn't care about it, it's probably assuming that x^0 always equals 1.

Function rsqrt

fn rsqrt<T: Algebraic>(value: T) -> T

Function signum

fn signum<T: Signed>(value: T) -> T

Function sin

fn sin<T: Trigonometric>(value: T) -> T

Function sin_cos

fn sin_cos<T: Trigonometric>(value: T) -> (T, T)

Function sinh

fn sinh<T: Hyperbolic>(value: T) -> T

Function sqrt

fn sqrt<T: Algebraic>(value: T) -> T

Function tan

fn tan<T: Trigonometric>(value: T) -> T

Function tanh

fn tanh<T: Hyperbolic>(value: T) -> T

Function zero

fn zero<T: Zero>() -> T