Module ops

Source

Traits§

Abs
✅ The absolute value of self.
Add
The addition operator +.
AddAssign
The addition assignment operator +=.
Ceil
✅ Rounds the number toward positive infinity if the result is representable. If rounding would cause an overflow, returns the original value unchanged.
CeilTo
✅ Rounds the number toward positive infinity to the specified number of fractional digits. If rounding would cause an overflow, returns the original value unchanged.
CheckedAdd
✅ Checked addition. Returns None if the result overflows.
CheckedDiv
✅ Checked division. Returns None on division by zero or overflow.
CheckedLn
✅ Returns the natural logarithm of self, or None if self is zero or negative.
CheckedLog10Floor
✅ Returns the base-10 logarithm of self, rounded down to the nearest integer, or None if self is zero or negative.
CheckedMul
✅ Checked multiplication. Returns None if the result overflows.
CheckedPow
✅ aises self to the power of exp, returning None on overflow or invalid input.
CheckedSqrt
✅ Returns the square root of self, or None if self is negative.
CheckedSub
✅ Checked subtraction. Returns None if the result overflows.
Div
The division operator /.
DivAssign
The division assignment operator /=.
Floor
✅ Rounds the number toward negative infinity if the result is representable. If rounding would cause an overflow, returns the original value unchanged.
FloorTo
✅ Rounds the number toward negative infinity to the specified number of fractional digits. If rounding would cause an overflow, returns the original value unchanged.
HasMax
✅ Checks if self is the maximum value.
HasMin
✅ Checks if self is the minimum value.
Mul
The multiplication operator *.
MulAssign
The multiplication assignment operator *=.
Neg
The unary negation operator -.
Rem
The remainder operator %.
Round
✅ Rounds the number to the nearest integer, away from zero on tie. If rounding would cause an overflow, returns the nearest representable result instead.
RoundTo
✅ Rounds the number to the nearest value with the specified number of fractional digits, away from zero on tie. If rounding would cause an overflow, returns the closest representable result instead.
SaturatingAdd
✅ Saturating addition. Clamps the result on overflow.
SaturatingDiv
✅ Saturating division. Returns Self::MAX or Self::MIN if division by zero or overflow occurs.
SaturatingMul
✅ Saturating multiplication. Clamps the result on overflow.
SaturatingSub
✅ Saturating subtraction. Clamps the result on overflow.
Signum
✅ The sign of the number.
Sub
The subtraction operator -.
SubAssign
The subtraction assignment operator -=.
Trunc
✅ Truncates fractional digits, rounding toward zero.
TruncTo
✅ Truncates to the specified number of fractional digits.
UncheckedAdd
Addition without checking for overflow.
UncheckedDiv
Division without checking for division by zero or overflow.
UncheckedLn
Returns the natural logarithm of self.
UncheckedLog10Floor
Returns the base-10 logarithm of self, rounded down to the nearest integer.
UncheckedMul
Multiplication without checking for overflow.
UncheckedPow
Raises self to the power of exp without checking for overflow or invalid input.
UncheckedSqrt
Returns the square root of self without checking the input.
UncheckedSub
Subtraction without checking for overflow.