Trait malachite_base::num::arithmetic::traits::NegMod
source · [−]Expand description
Divides the negative of a number by another number, returning the remainder.
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 NegMod<u8> for u8
impl NegMod<u8> for u8
sourcefn neg_mod(self, other: u8) -> u8
fn neg_mod(self, other: u8) -> u8
Divides the negative of 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) = y\left \lceil \frac{x}{y} \right \rceil - x. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u8
sourceimpl NegMod<u16> for u16
impl NegMod<u16> for u16
sourcefn neg_mod(self, other: u16) -> u16
fn neg_mod(self, other: u16) -> u16
Divides the negative of 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) = y\left \lceil \frac{x}{y} \right \rceil - x. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u16
sourceimpl NegMod<u32> for u32
impl NegMod<u32> for u32
sourcefn neg_mod(self, other: u32) -> u32
fn neg_mod(self, other: u32) -> u32
Divides the negative of 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) = y\left \lceil \frac{x}{y} \right \rceil - x. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u32
sourceimpl NegMod<u64> for u64
impl NegMod<u64> for u64
sourcefn neg_mod(self, other: u64) -> u64
fn neg_mod(self, other: u64) -> u64
Divides the negative of 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) = y\left \lceil \frac{x}{y} \right \rceil - x. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u64
sourceimpl NegMod<u128> for u128
impl NegMod<u128> for u128
sourcefn neg_mod(self, other: u128) -> u128
fn neg_mod(self, other: u128) -> u128
Divides the negative of 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) = y\left \lceil \frac{x}{y} \right \rceil - x. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = u128
sourceimpl NegMod<usize> for usize
impl NegMod<usize> for usize
sourcefn neg_mod(self, other: usize) -> usize
fn neg_mod(self, other: usize) -> usize
Divides the negative of 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) = y\left \lceil \frac{x}{y} \right \rceil - x. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.