Skip to main content

CeilingMod

Trait CeilingMod 

Source
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§

Source

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

Source§

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.

Source§

type Output = i8

Source§

impl CeilingMod for i16

Source§

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.

Source§

type Output = i16

Source§

impl CeilingMod for i32

Source§

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.

Source§

type Output = i32

Source§

impl CeilingMod for i64

Source§

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.

Source§

type Output = i64

Source§

impl CeilingMod for i128

Source§

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.

Source§

type Output = i128

Source§

impl CeilingMod for isize

Source§

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.

Source§

type Output = isize

Implementors§