Trait malachite_base::num::arithmetic::traits::ModAssign
source · [−]pub trait ModAssign<RHS = Self> {
fn mod_assign(&mut self, other: RHS);
}
Expand description
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the divisor (second number).
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
Required Methods
fn mod_assign(&mut self, other: RHS)
Implementations on Foreign Types
sourceimpl ModAssign<u8> for u8
impl ModAssign<u8> for u8
sourcefn mod_assign(&mut self, other: u8)
fn mod_assign(&mut self, other: u8)
Divides a number by another number, replacing the first number by the remainder.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<u16> for u16
impl ModAssign<u16> for u16
sourcefn mod_assign(&mut self, other: u16)
fn mod_assign(&mut self, other: u16)
Divides a number by another number, replacing the first number by the remainder.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<u32> for u32
impl ModAssign<u32> for u32
sourcefn mod_assign(&mut self, other: u32)
fn mod_assign(&mut self, other: u32)
Divides a number by another number, replacing the first number by the remainder.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<u64> for u64
impl ModAssign<u64> for u64
sourcefn mod_assign(&mut self, other: u64)
fn mod_assign(&mut self, other: u64)
Divides a number by another number, replacing the first number by the remainder.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<u128> for u128
impl ModAssign<u128> for u128
sourcefn mod_assign(&mut self, other: u128)
fn mod_assign(&mut self, other: u128)
Divides a number by another number, replacing the first number by the remainder.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<usize> for usize
impl ModAssign<usize> for usize
sourcefn mod_assign(&mut self, other: usize)
fn mod_assign(&mut self, other: usize)
Divides a number by another number, replacing the first number by the remainder.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<i8> for i8
impl ModAssign<i8> for i8
sourcefn mod_assign(&mut self, other: i8)
fn mod_assign(&mut self, other: i8)
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the second number.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<i16> for i16
impl ModAssign<i16> for i16
sourcefn mod_assign(&mut self, other: i16)
fn mod_assign(&mut self, other: i16)
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the second number.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<i32> for i32
impl ModAssign<i32> for i32
sourcefn mod_assign(&mut self, other: i32)
fn mod_assign(&mut self, other: i32)
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the second number.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<i64> for i64
impl ModAssign<i64> for i64
sourcefn mod_assign(&mut self, other: i64)
fn mod_assign(&mut self, other: i64)
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the second number.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<i128> for i128
impl ModAssign<i128> for i128
sourcefn mod_assign(&mut self, other: i128)
fn mod_assign(&mut self, other: i128)
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the second number.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
sourceimpl ModAssign<isize> for isize
impl ModAssign<isize> for isize
sourcefn mod_assign(&mut self, other: isize)
fn mod_assign(&mut self, other: isize)
Divides a number by another number, replacing the first number by the remainder. The remainder has the same sign as the second number.
If the quotient were computed, he quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ x \gets x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.