Skip to main content

BalancedModAssign

Trait BalancedModAssign 

Source
pub trait BalancedModAssign<RHS = Self> {
    // Required method
    fn balanced_mod_assign(&mut self, other: RHS);
}
Expand description

Divides a number by another number, replacing the first number by the balanced remainder: the representative of the first number modulo the second that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$, so a remainder of exactly $|y|/2$ is positive.

Required Methods§

Source

fn balanced_mod_assign(&mut self, other: RHS)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl BalancedModAssign for i8

Source§

fn balanced_mod_assign(&mut self, other: i8)

Divides a number by another number, replacing the first number by the balanced remainder: the representative of self modulo other that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$; a remainder of exactly $|y|/2$ is positive.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is zero.

§Examples

See here.

Source§

impl BalancedModAssign for i16

Source§

fn balanced_mod_assign(&mut self, other: i16)

Divides a number by another number, replacing the first number by the balanced remainder: the representative of self modulo other that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$; a remainder of exactly $|y|/2$ is positive.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is zero.

§Examples

See here.

Source§

impl BalancedModAssign for i32

Source§

fn balanced_mod_assign(&mut self, other: i32)

Divides a number by another number, replacing the first number by the balanced remainder: the representative of self modulo other that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$; a remainder of exactly $|y|/2$ is positive.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is zero.

§Examples

See here.

Source§

impl BalancedModAssign for i64

Source§

fn balanced_mod_assign(&mut self, other: i64)

Divides a number by another number, replacing the first number by the balanced remainder: the representative of self modulo other that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$; a remainder of exactly $|y|/2$ is positive.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is zero.

§Examples

See here.

Source§

impl BalancedModAssign for i128

Source§

fn balanced_mod_assign(&mut self, other: i128)

Divides a number by another number, replacing the first number by the balanced remainder: the representative of self modulo other that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$; a remainder of exactly $|y|/2$ is positive.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is zero.

§Examples

See here.

Source§

impl BalancedModAssign for isize

Source§

fn balanced_mod_assign(&mut self, other: isize)

Divides a number by another number, replacing the first number by the balanced remainder: the representative of self modulo other that is closest to zero.

The remainder $r$ satisfies $-|y|/2 < r \leq |y|/2$; a remainder of exactly $|y|/2$ is positive.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if other is zero.

§Examples

See here.

Implementors§