pub trait SaturatingSquareAssign {
    fn saturating_square_assign(&mut self);
}
Expand description

Squares a number in place, saturating at the numeric bounds instead of overflowing.

Required Methods

Implementations on Foreign Types

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Squares a number in place, saturating at the numeric bounds instead of overflowing.

$$ x \gets \begin{cases} x^2 & \text{if} \quad x^2 \leq M, \\ M & \text{if} \quad x^2 > M, \end{cases} $$ where $M$ is Self::MAX.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors