Module num

Source
Expand description

Traits for abstracting over numeric types.

These traits describe various numeric properties and operations. They are similar in purpose to the immensely helpful traits in num-traits, but the structure is different. The philosophy behind this module is to focus on capabilities, rather than categories, and to assume as little as possible. Within reason.

Instead of having large traits with a lot of methods and dependencies, each operation (or group of operations), are separated into their own traits. This allows number types to have partial compatibility by only implementing some of the traits, and new methods can be added as new traits without affecting old functionality.

Traits§

Abs
Method for getting the absolute value of a number.
Arithmetics
A helper trait that collects arithmetic traits under one name.
Cbrt
Method for getting the cube root of a number.
Clamp
Trait for clamping a value.
ClampAssign
Assigning trait for clamping a value.
Exp
Methods for calculating e ^ x,
FromScalar
Trait for creating a vectorized value from a scalar value.
FromScalarArray
Conversion from an array of scalars to a vectorized value.
Hypot
Methods for calculating the lengths of a hypotenuse.
IntoScalarArray
Conversion from a vectorized value to an array of scalars.
IsValidDivisor
Methods for checking if a number can be used as a divisor.
Ln
Trait for getting the natural logarithm of self.
MinMax
Methods for getting the largest or smallest of two values.
MulAdd
Combined multiplication and addition operation.
MulSub
Combined multiplication and subtraction operation.
One
Methods for the value 1.
PartialCmp
Trait for lanewise comparison of two values.
Powf
Method for raising a number by a real number exponent.
Powi
Method for raising a number by a signed integer exponent.
Powu
Method for raising a number by a n unsigned integer exponent.
Real
Numbers that belong to the real number set. It’s both a semantic marker and provides a constructor for number constants.
Recip
Method for calculating 1 / x.
Round
Methods for rounding numbers to integers.
SaturatingAdd
Saturating addition operation.
SaturatingSub
Saturating subtraction operation.
Signum
Trait for getting a number that represents the sign of self.
Sqrt
Method for getting the square root of a number.
Trigonometry
Trigonometry methods and their inverses.
Zero
Methods for the value 0.