Trait malachite_base::num::arithmetic::traits::CeilingMod
source · pub trait CeilingMod<RHS = Self> {
type Output;
fn ceiling_mod(self, other: RHS) -> Self::Output;
}
Expand description
Divides a number by another number, returning just the remainder. The remainder has the opposite 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§
fn ceiling_mod(self, other: RHS) -> Self::Output
Implementations on Foreign Types§
source§impl CeilingMod<i8> for i8
impl CeilingMod<i8> for i8
source§fn ceiling_mod(self, other: i8) -> i8
fn ceiling_mod(self, other: i8) -> i8
Divides a number by another number, returning just the remainder. The remainder has the opposite 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 \lceil \frac{x}{y} \right \rceil. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i8
source§impl CeilingMod<i16> for i16
impl CeilingMod<i16> for i16
source§fn ceiling_mod(self, other: i16) -> i16
fn ceiling_mod(self, other: i16) -> i16
Divides a number by another number, returning just the remainder. The remainder has the opposite 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 \lceil \frac{x}{y} \right \rceil. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i16
source§impl CeilingMod<i32> for i32
impl CeilingMod<i32> for i32
source§fn ceiling_mod(self, other: i32) -> i32
fn ceiling_mod(self, other: i32) -> i32
Divides a number by another number, returning just the remainder. The remainder has the opposite 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 \lceil \frac{x}{y} \right \rceil. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i32
source§impl CeilingMod<i64> for i64
impl CeilingMod<i64> for i64
source§fn ceiling_mod(self, other: i64) -> i64
fn ceiling_mod(self, other: i64) -> i64
Divides a number by another number, returning just the remainder. The remainder has the opposite 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 \lceil \frac{x}{y} \right \rceil. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i64
source§impl CeilingMod<i128> for i128
impl CeilingMod<i128> for i128
source§fn ceiling_mod(self, other: i128) -> i128
fn ceiling_mod(self, other: i128) -> i128
Divides a number by another number, returning just the remainder. The remainder has the opposite 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 \lceil \frac{x}{y} \right \rceil. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.
type Output = i128
source§impl CeilingMod<isize> for isize
impl CeilingMod<isize> for isize
source§fn ceiling_mod(self, other: isize) -> isize
fn ceiling_mod(self, other: isize) -> isize
Divides a number by another number, returning just the remainder. The remainder has the opposite 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 \lceil \frac{x}{y} \right \rceil. $$
Worst-case complexity
Constant time and additional memory.
Panics
Panics if other
is 0.
Examples
See here.