Skip to main content

NegMod

Trait NegMod 

Source
pub trait NegMod<RHS = Self> {
    type Output;

    // Required method
    fn neg_mod(self, other: RHS) -> Self::Output;
}
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§

Source

fn neg_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 NegMod for u8

Source§

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.

Source§

type Output = u8

Source§

impl NegMod for u16

Source§

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.

Source§

type Output = u16

Source§

impl NegMod for u32

Source§

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.

Source§

type Output = u32

Source§

impl NegMod for u64

Source§

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.

Source§

type Output = u64

Source§

impl NegMod for u128

Source§

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.

Source§

type Output = u128

Source§

impl NegMod for usize

Source§

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.

Source§

type Output = usize

Implementors§