Trait malachite_base::num::arithmetic::traits::SaturatingSquareAssign
source · [−]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
fn saturating_square_assign(&mut self)
Implementations on Foreign Types
sourceimpl SaturatingSquareAssign for u8
impl SaturatingSquareAssign for u8
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for u16
impl SaturatingSquareAssign for u16
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for u32
impl SaturatingSquareAssign for u32
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for u64
impl SaturatingSquareAssign for u64
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for u128
impl SaturatingSquareAssign for u128
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for usize
impl SaturatingSquareAssign for usize
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for i8
impl SaturatingSquareAssign for i8
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for i16
impl SaturatingSquareAssign for i16
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for i32
impl SaturatingSquareAssign for i32
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for i64
impl SaturatingSquareAssign for i64
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for i128
impl SaturatingSquareAssign for i128
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.
sourceimpl SaturatingSquareAssign for isize
impl SaturatingSquareAssign for isize
sourcefn saturating_square_assign(&mut self)
fn saturating_square_assign(&mut self)
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.