Trait malachite_base::num::arithmetic::traits::CeilingDivNegMod

source ·
pub trait CeilingDivNegMod<RHS = Self> {
    type DivOutput;
    type ModOutput;

    // Required method
    fn ceiling_div_neg_mod(
        self,
        other: RHS,
    ) -> (Self::DivOutput, Self::ModOutput);
}
Expand description

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

Required Associated Types§

Required Methods§

source

fn ceiling_div_neg_mod(self, other: RHS) -> (Self::DivOutput, Self::ModOutput)

Implementations on Foreign Types§

source§

impl CeilingDivNegMod for u8

source§

fn ceiling_div_neg_mod(self, other: u8) -> (u8, u8)

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

$$ f(x, y) = \left ( \left \lceil \frac{x}{y} \right \rceil, \space y\left \lceil \frac{x}{y} \right \rceil - x \right ). $$

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0.

§Examples

See here.

source§

type DivOutput = u8

source§

type ModOutput = u8

source§

impl CeilingDivNegMod for u16

source§

fn ceiling_div_neg_mod(self, other: u16) -> (u16, u16)

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

$$ f(x, y) = \left ( \left \lceil \frac{x}{y} \right \rceil, \space y\left \lceil \frac{x}{y} \right \rceil - x \right ). $$

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0.

§Examples

See here.

source§

type DivOutput = u16

source§

type ModOutput = u16

source§

impl CeilingDivNegMod for u32

source§

fn ceiling_div_neg_mod(self, other: u32) -> (u32, u32)

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

$$ f(x, y) = \left ( \left \lceil \frac{x}{y} \right \rceil, \space y\left \lceil \frac{x}{y} \right \rceil - x \right ). $$

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0.

§Examples

See here.

source§

type DivOutput = u32

source§

type ModOutput = u32

source§

impl CeilingDivNegMod for u64

source§

fn ceiling_div_neg_mod(self, other: u64) -> (u64, u64)

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

$$ f(x, y) = \left ( \left \lceil \frac{x}{y} \right \rceil, \space y\left \lceil \frac{x}{y} \right \rceil - x \right ). $$

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0.

§Examples

See here.

source§

type DivOutput = u64

source§

type ModOutput = u64

source§

impl CeilingDivNegMod for u128

source§

fn ceiling_div_neg_mod(self, other: u128) -> (u128, u128)

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

$$ f(x, y) = \left ( \left \lceil \frac{x}{y} \right \rceil, \space y\left \lceil \frac{x}{y} \right \rceil - x \right ). $$

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0.

§Examples

See here.

source§

type DivOutput = u128

source§

type ModOutput = u128

source§

impl CeilingDivNegMod for usize

source§

fn ceiling_div_neg_mod(self, other: usize) -> (usize, usize)

Divides a number by another number, returning the ceiling of the quotient and the remainder of the negative of the first number divided by the second.

The quotient and remainder satisfy $x = qy - r$ and $0 \leq r < y$.

$$ f(x, y) = \left ( \left \lceil \frac{x}{y} \right \rceil, \space y\left \lceil \frac{x}{y} \right \rceil - x \right ). $$

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0.

§Examples

See here.

source§

type DivOutput = usize

source§

type ModOutput = usize

Implementors§