pub trait DivAssignRem<RHS = Self> {
    type RemOutput;

    fn div_assign_rem(&mut self, other: RHS) -> Self::RemOutput;
}
Expand description

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero, and the remainder has the same sign as the dividend (first input).

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

Required Associated Types

Required Methods

Implementations on Foreign Types

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero.

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

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

For unsigned integers, div_assign_rem is equivalent to div_assign_mod.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if other is 0.

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero.

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

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

For unsigned integers, div_assign_rem is equivalent to div_assign_mod.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if other is 0.

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero.

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

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

For unsigned integers, div_assign_rem is equivalent to div_assign_mod.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if other is 0.

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero.

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

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

For unsigned integers, div_assign_rem is equivalent to div_assign_mod.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if other is 0.

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero.

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

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

For unsigned integers, div_assign_rem is equivalent to div_assign_mod.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if other is 0.

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero.

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

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

For unsigned integers, div_assign_rem is equivalent to div_assign_mod.

Worst-case complexity

Constant time and additional memory.

Panics

Panics if other is 0.

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero and the remainder has the same sign as the dividend.

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

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

Worst-case complexity

Constant time and additional memory.

Panics

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

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero and the remainder has the same sign as the dividend.

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

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

Worst-case complexity

Constant time and additional memory.

Panics

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

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero and the remainder has the same sign as the dividend.

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

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

Worst-case complexity

Constant time and additional memory.

Panics

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

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero and the remainder has the same sign as the dividend.

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

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

Worst-case complexity

Constant time and additional memory.

Panics

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

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero and the remainder has the same sign as the dividend.

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

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

Worst-case complexity

Constant time and additional memory.

Panics

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

Examples

See here.

Divides a number by another number in place, returning the remainder. The quotient is rounded towards zero and the remainder has the same sign as the dividend.

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

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

Worst-case complexity

Constant time and additional memory.

Panics

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

Examples

See here.

Implementors