pub trait CeilingMod<RHS = Self> {
type Output;
// Required method
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
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl CeilingMod for i8
impl CeilingMod 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 for i16
impl CeilingMod 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 for i32
impl CeilingMod 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 for i64
impl CeilingMod 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 for i128
impl CeilingMod 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 for isize
impl CeilingMod 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.