Trait malachite_base::num::arithmetic::traits::DivAssignMod
source · [−]pub trait DivAssignMod<RHS = Self> {
type ModOutput;
fn div_assign_mod(&mut self, other: RHS) -> Self::ModOutput;
}
Expand description
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the divisor (second input).
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
Required Associated Types
Required Methods
fn div_assign_mod(&mut self, other: RHS) -> Self::ModOutput
Implementations on Foreign Types
sourceimpl DivAssignMod<u8> for u8
impl DivAssignMod<u8> for u8
sourcefn div_assign_mod(&mut self, other: u8) -> u8
fn div_assign_mod(&mut self, other: u8) -> u8
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type ModOutput = u8
sourceimpl DivAssignMod<u16> for u16
impl DivAssignMod<u16> for u16
sourcefn div_assign_mod(&mut self, other: u16) -> u16
fn div_assign_mod(&mut self, other: u16) -> u16
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type ModOutput = u16
sourceimpl DivAssignMod<u32> for u32
impl DivAssignMod<u32> for u32
sourcefn div_assign_mod(&mut self, other: u32) -> u32
fn div_assign_mod(&mut self, other: u32) -> u32
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type ModOutput = u32
sourceimpl DivAssignMod<u64> for u64
impl DivAssignMod<u64> for u64
sourcefn div_assign_mod(&mut self, other: u64) -> u64
fn div_assign_mod(&mut self, other: u64) -> u64
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type ModOutput = u64
sourceimpl DivAssignMod<u128> for u128
impl DivAssignMod<u128> for u128
sourcefn div_assign_mod(&mut self, other: u128) -> u128
fn div_assign_mod(&mut self, other: u128) -> u128
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type ModOutput = u128
sourceimpl DivAssignMod<usize> for usize
impl DivAssignMod<usize> for usize
sourcefn div_assign_mod(&mut self, other: usize) -> usize
fn div_assign_mod(&mut self, other: usize) -> usize
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type ModOutput = usize
sourceimpl DivAssignMod<i8> for i8
impl DivAssignMod<i8> for i8
sourcefn div_assign_mod(&mut self, other: i8) -> i8
fn div_assign_mod(&mut self, other: i8) -> i8
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0, or if self
is $t::MIN
and other
is -1.
Examples
See here.
type ModOutput = i8
sourceimpl DivAssignMod<i16> for i16
impl DivAssignMod<i16> for i16
sourcefn div_assign_mod(&mut self, other: i16) -> i16
fn div_assign_mod(&mut self, other: i16) -> i16
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0, or if self
is $t::MIN
and other
is -1.
Examples
See here.
type ModOutput = i16
sourceimpl DivAssignMod<i32> for i32
impl DivAssignMod<i32> for i32
sourcefn div_assign_mod(&mut self, other: i32) -> i32
fn div_assign_mod(&mut self, other: i32) -> i32
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0, or if self
is $t::MIN
and other
is -1.
Examples
See here.
type ModOutput = i32
sourceimpl DivAssignMod<i64> for i64
impl DivAssignMod<i64> for i64
sourcefn div_assign_mod(&mut self, other: i64) -> i64
fn div_assign_mod(&mut self, other: i64) -> i64
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0, or if self
is $t::MIN
and other
is -1.
Examples
See here.
type ModOutput = i64
sourceimpl DivAssignMod<i128> for i128
impl DivAssignMod<i128> for i128
sourcefn div_assign_mod(&mut self, other: i128) -> i128
fn div_assign_mod(&mut self, other: i128) -> i128
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0, or if self
is $t::MIN
and other
is -1.
Examples
See here.
type ModOutput = i128
sourceimpl DivAssignMod<isize> for isize
impl DivAssignMod<isize> for isize
sourcefn div_assign_mod(&mut self, other: isize) -> isize
fn div_assign_mod(&mut self, other: isize) -> isize
Divides a number by another number in place, returning the remainder. The quotient is rounded towards negative infinity, and the remainder has the same sign as the second number.
The quotient and remainder satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor, $$ $$ x \gets \left \lfloor \frac{x}{y} \right \rfloor. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0, or if self
is $t::MIN
and other
is -1.
Examples
See here.