Trait malachite_base::num::arithmetic::traits::Mod
source · pub trait Mod<RHS = Self> {
type Output;
// Required method
fn mod_op(self, other: RHS) -> Self::Output;
}
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§
source§impl Mod for i8
impl Mod for i8
source§fn 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
source§impl Mod for i16
impl Mod for i16
source§fn 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
source§impl Mod for i32
impl Mod for i32
source§fn 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
source§impl Mod for i64
impl Mod for i64
source§fn 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
source§impl Mod for i128
impl Mod for i128
source§fn 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
source§impl Mod for isize
impl Mod for isize
source§fn 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.
type Output = isize
source§impl Mod for u8
impl Mod for u8
source§fn 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
source§impl Mod for u16
impl Mod for u16
source§fn 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
source§impl Mod for u32
impl Mod for u32
source§fn 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
source§impl Mod for u64
impl Mod for u64
source§fn 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
source§impl Mod for u128
impl Mod for u128
source§fn 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
source§impl Mod for usize
impl Mod for usize
source§fn 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.