Module num::traits [-] [+] [src]

Numeric traits for generic mathematics

Traits

Bounded

Numbers which have upper and lower bounds

CheckedAdd

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

CheckedDiv

Performs division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and 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
FromPrimitive

A generic trait for converting a number to a value.

Num

The base trait for numeric types

NumCast

An interface for casting between machine scalars.

One

Defines a multiplicative identity element for Self.

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

Unsigned

A trait for values which cannot be negative

Zero

Defines an additive identity element for Self.

Functions

cast

Cast from one machine scalar to another.