Trait malachite_base::num::arithmetic::traits::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

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.

§

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.

§

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.

§

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.

§

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.

§

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.

§

type Output = usize

Implementors§