Trait malachite_base::num::arithmetic::traits::Mod
source · [−]Expand description
Divides a number by another number, returning just 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 Associated Types
Required Methods
Implementations on Foreign Types
sourceimpl Mod<u8> for u8
impl Mod<u8> for u8
sourcefn mod_op(self, other: u8) -> u8
fn mod_op(self, other: u8) -> u8
Divides a number by another number, returning just the remainder.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u8
sourceimpl Mod<u16> for u16
impl Mod<u16> for u16
sourcefn mod_op(self, other: u16) -> u16
fn mod_op(self, other: u16) -> u16
Divides a number by another number, returning just the remainder.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u16
sourceimpl Mod<u32> for u32
impl Mod<u32> for u32
sourcefn mod_op(self, other: u32) -> u32
fn mod_op(self, other: u32) -> u32
Divides a number by another number, returning just the remainder.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u32
sourceimpl Mod<u64> for u64
impl Mod<u64> for u64
sourcefn mod_op(self, other: u64) -> u64
fn mod_op(self, other: u64) -> u64
Divides a number by another number, returning just the remainder.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u64
sourceimpl Mod<u128> for u128
impl Mod<u128> for u128
sourcefn mod_op(self, other: u128) -> u128
fn mod_op(self, other: u128) -> u128
Divides a number by another number, returning just the remainder.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u128
sourceimpl Mod<usize> for usize
impl Mod<usize> for usize
sourcefn mod_op(self, other: usize) -> usize
fn mod_op(self, other: usize) -> usize
Divides a number by another number, returning just the remainder.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq r < y$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = usize
sourceimpl Mod<i8> for i8
impl Mod<i8> for i8
sourcefn mod_op(self, other: i8) -> i8
fn mod_op(self, other: i8) -> i8
Divides a number by another number, returning just the remainder. The remainder has the same sign as the second number.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i8
sourceimpl Mod<i16> for i16
impl Mod<i16> for i16
sourcefn mod_op(self, other: i16) -> i16
fn mod_op(self, other: i16) -> i16
Divides a number by another number, returning just the remainder. The remainder has the same sign as the second number.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i16
sourceimpl Mod<i32> for i32
impl Mod<i32> for i32
sourcefn mod_op(self, other: i32) -> i32
fn mod_op(self, other: i32) -> i32
Divides a number by another number, returning just the remainder. The remainder has the same sign as the second number.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i32
sourceimpl Mod<i64> for i64
impl Mod<i64> for i64
sourcefn mod_op(self, other: i64) -> i64
fn mod_op(self, other: i64) -> i64
Divides a number by another number, returning just the remainder. The remainder has the same sign as the second number.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i64
sourceimpl Mod<i128> for i128
impl Mod<i128> for i128
sourcefn mod_op(self, other: i128) -> i128
fn mod_op(self, other: i128) -> i128
Divides a number by another number, returning just the remainder. The remainder has the same sign as the second number.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i128
sourceimpl Mod<isize> for isize
impl Mod<isize> for isize
sourcefn mod_op(self, other: isize) -> isize
fn mod_op(self, other: isize) -> isize
Divides a number by another number, returning just the remainder. The remainder has the same sign as the second number.
If the quotient were computed, the quotient and remainder would satisfy $x = qy + r$ and $0 \leq |r| < |y|$.
$$ f(x, y) = x - y\left \lfloor \frac{x}{y} \right \rfloor. $$
This function is called mod_op
rather than mod
because mod
is a Rust keyword.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.