Skip to main content

DivAssignModEuclidean

Trait DivAssignModEuclidean 

Source
pub trait DivAssignModEuclidean<RHS = Self> {
    type ModOutput;

    // Required method
    fn div_assign_mod_euclidean(&mut self, other: RHS) -> Self::ModOutput;
}
Expand description

Divides a number by another number in place, returning the remainder. The quotient is rounded towards the quotient that makes the remainder nonnegative, and the remainder is always nonnegative.

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

Required Associated Types§

Required Methods§

Source

fn div_assign_mod_euclidean(&mut self, other: RHS) -> Self::ModOutput

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DivAssignModEuclidean for i8

Source§

fn div_assign_mod_euclidean(&mut self, other: i8) -> i8

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = i8

Source§

impl DivAssignModEuclidean for i16

Source§

fn div_assign_mod_euclidean(&mut self, other: i16) -> i16

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = i16

Source§

impl DivAssignModEuclidean for i32

Source§

fn div_assign_mod_euclidean(&mut self, other: i32) -> i32

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = i32

Source§

impl DivAssignModEuclidean for i64

Source§

fn div_assign_mod_euclidean(&mut self, other: i64) -> i64

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = i64

Source§

impl DivAssignModEuclidean for i128

Source§

fn div_assign_mod_euclidean(&mut self, other: i128) -> i128

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = i128

Source§

impl DivAssignModEuclidean for isize

Source§

fn div_assign_mod_euclidean(&mut self, other: isize) -> isize

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = isize

Source§

impl DivAssignModEuclidean for u8

Source§

fn div_assign_mod_euclidean(&mut self, other: u8) -> u8

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = u8

Source§

impl DivAssignModEuclidean for u16

Source§

fn div_assign_mod_euclidean(&mut self, other: u16) -> u16

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = u16

Source§

impl DivAssignModEuclidean for u32

Source§

fn div_assign_mod_euclidean(&mut self, other: u32) -> u32

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = u32

Source§

impl DivAssignModEuclidean for u64

Source§

fn div_assign_mod_euclidean(&mut self, other: u64) -> u64

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = u64

Source§

impl DivAssignModEuclidean for u128

Source§

fn div_assign_mod_euclidean(&mut self, other: u128) -> u128

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = u128

Source§

impl DivAssignModEuclidean for usize

Source§

fn div_assign_mod_euclidean(&mut self, other: usize) -> usize

Divides a number by another number in place, returning the remainder. The quotient is rounded so that the remainder is nonnegative.

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

$$ f(x, y) = x - y \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor, $$ $$ x \gets \operatorname{sgn}(y) \left \lfloor \frac{x}{|y|} \right \rfloor. $$

For unsigned integers, div_assign_mod_euclidean is equivalent to div_assign_mod.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is 0, or if self is $t::MIN and other is -1 (when $t is signed).

§Examples

See here.

Source§

type ModOutput = usize

Implementors§