Expand description

Traits for arithmetic.

Modules

Addition of Naturals.

Implementations of AddMul and AddMulAssign, traits for adding a number and the product of two other numbers.

Implementations of CheckedSub, a trait for subtracting two numbers and checking whether the result is representable.

Implementations of CheckedSubMul, a trait for subtracting the product of two numbers from another number, and checking whether the result is representable.

Implementations of CoprimeWith, a trait for determining whether two numbers are coprime.

Division of Naturals.

Implementations of DivExact and DivExactAssign, traits for dividing two numbers when it’s known that the division is exact.

Implementations of raits for simultaneously finding the quotient and remainder of two numbers, subject to various rounding rules.

Implementations of DivRound and DivExactAssign, traits for dividing two numbers according to a specified RoundingMode.

Implementations of DivisibleBy, a trait for determining whether one number is divisible by another.

Implementations of DivisibleByPowerOf2, a trait for determining whether a number is divisible by $2^k$.

Implementations of EqMod, a trait for determining whether one number is equal by another modulo a third.

Implementations of EqModPowerOf2, a trait for determining whether one number is equal to another modulo $2^k$.

Implementations of Gcd and GcdAssign, traits for computing the GCD (greatest common divisor) of two numbers.

Implementations of IsPowerOf2, a trait for determining whether a number is an integer power of 2.

Implementations of Lcm, LcmAssign, and CheckedLcm, traits for computing the LCM (least common multiple) of two numbers.

Implementations of traits for taking the base-$b$ logarithm of a number.

Implementations of traits for taking the base-2 logarithm of a number.

Implementations of traits for taking the base-$2^k$ logarithm of a number.

Implementations of ModAdd and ModAddAssign, traits for adding two numbers modulo another number.

Implementations of ModIsReduced, a trait for checking whether a number is reduced modulo another number.

Implementations of traits for multiplying two numbers modulo another number.

Implementations of ModNeg and ModNegAssign, traits for negating a number modulo another number.

Implementations of traits for finding the remainder of two numbers, subject to various rounding rules.

Implementations of traits for raising a number to a power modulo another number.

Implementations of traits for finding the remainder of a number divided by $2^k$, subject to various rounding rules.

Implementations of ModPowerOf2Add and ModPowerOf2AddAssign, traits for adding two numbers modulo $2^k$.

Implementations of ModPowerOf2IsReduced, a trait for checking whether a number is reduced modulo $2^k$.

Implementations of ModPowerOf2Mul and ModPowerOf2MulAssign, traits for multiplying two numbers modulo $2^k$.

Implementations of ModPowerOf2Neg and ModPowerOf2NegAssign, traits for negating a number modulo $2^k$.

Implementations of ModPowerOf2Pow and ModPowerOf2PowAssign, traits for raising a number to a power modulo $2^k$.

Implementations of ModPowerOf2Shl and ModPowerOf2ShlAssign, traits for left-shifting a number modulo $2^k$.

Implementations of ModPowerOf2Shr and ModPowerOf2ShrAssign, traits for right-shifting a number modulo $2^k$.

Implementations of ModPowerOf2Square](malachite_base::num::arithmetic::traits::ModPowerOf2Square) and ModPowerOf2SquareAssign, traits for squaring a number modulo $2^k$.

Implementations of ModPowerOf2Sub and ModPowerOf2SubAssign, traits for subtracting one number by another modulo $2^k$.

Implementations of ModShl and ModShlAssign, traits for left-shifting a number modulo another number.

Implementations of ModShr and ModShrAssign, traits for right-shifting a number modulo another number.

Implementations of traits for squaring a number modulo another number.

Implementations of ModSub and ModSubAssign, traits for subtracting two numbers modulo another number.

Multiplication of Naturals.

Negation of a Natural, returning an Integer.

Implementations of NextPowerOf2 and NextPowerOf2Assign, traits for getting the next-highest power of 2.

Implementations of Parity, a trait for determining whether a number is even or odd.

Implementations of Pow and PowAssign, traits for raising a number to a power.

Implementations of PowerOf2, a trait for computing a power of 2.

Implementations of traits for taking the $n$th root of a number.

Implementations of RoundToMultiple and RoundToMultipleAssign, traits for rounding a number to a multiple of another number.

Implementations of RoundToMultipleOfPowerOf2 and RoundToMultipleOfPowerOf2Assign, traits for rounding a number to a multiple of a power of 2.

Implementations of SaturatingSub and SaturatingSubAssign, traits for subtracting two numbers and saturating at numeric bounds instead of overflowing.

Implementations of SaturatingSubMul and SaturatingSubMulAssign, traits for subtracting a number by the product of two numbers and saturating at numeric bounds instead of overflowing.

Left-shifting a Natural (multiplying it by a power of 2).

Implementations of ShlRound and ShlRoundAssign, traits for multiplying a number by a power of 2 and rounding according to a specified RoundingMode.

Right-shifting a Natural (dividing it by a power of 2).

Implementations of ShrRound and ShrRoundAssign, traits for dividing a number by a power of 2 and rounding according to a specified RoundingMode.

Implementations of Sign, a trait for determining the sign of a number.

Implementations of traits for taking the square root of a number.

Implementations of Square and SquareAssign, traits for squaring a number.

Subtraction of Naturals.

Implementations of SubMul and SubMulAssign, traits for subtracting the product of two numbers from a number.