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
sourceimpl CeilingMod<i8> for i8
impl CeilingMod<i8> for i8
sourcefn 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
sourceimpl CeilingMod<i16> for i16
impl CeilingMod<i16> for i16
sourcefn 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
sourceimpl CeilingMod<i32> for i32
impl CeilingMod<i32> for i32
sourcefn 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
sourceimpl CeilingMod<i64> for i64
impl CeilingMod<i64> for i64
sourcefn 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
sourceimpl CeilingMod<i128> for i128
impl CeilingMod<i128> for i128
sourcefn 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
sourceimpl CeilingMod<isize> for isize
impl CeilingMod<isize> for isize
sourcefn 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.