Trait malachite_base::num::arithmetic::traits::SaturatingSubAssign
source · pub trait SaturatingSubAssign<RHS = Self> {
// Required method
fn saturating_sub_assign(&mut self, other: RHS);
}
Expand description
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
Required Methods§
fn saturating_sub_assign(&mut self, other: RHS)
Implementations on Foreign Types§
source§impl SaturatingSubAssign for i8
impl SaturatingSubAssign for i8
source§fn saturating_sub_assign(&mut self, other: i8)
fn saturating_sub_assign(&mut self, other: i8)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for i16
impl SaturatingSubAssign for i16
source§fn saturating_sub_assign(&mut self, other: i16)
fn saturating_sub_assign(&mut self, other: i16)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for i32
impl SaturatingSubAssign for i32
source§fn saturating_sub_assign(&mut self, other: i32)
fn saturating_sub_assign(&mut self, other: i32)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for i64
impl SaturatingSubAssign for i64
source§fn saturating_sub_assign(&mut self, other: i64)
fn saturating_sub_assign(&mut self, other: i64)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for i128
impl SaturatingSubAssign for i128
source§fn saturating_sub_assign(&mut self, other: i128)
fn saturating_sub_assign(&mut self, other: i128)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for isize
impl SaturatingSubAssign for isize
source§fn saturating_sub_assign(&mut self, other: isize)
fn saturating_sub_assign(&mut self, other: isize)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for u8
impl SaturatingSubAssign for u8
source§fn saturating_sub_assign(&mut self, other: u8)
fn saturating_sub_assign(&mut self, other: u8)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for u16
impl SaturatingSubAssign for u16
source§fn saturating_sub_assign(&mut self, other: u16)
fn saturating_sub_assign(&mut self, other: u16)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for u32
impl SaturatingSubAssign for u32
source§fn saturating_sub_assign(&mut self, other: u32)
fn saturating_sub_assign(&mut self, other: u32)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for u64
impl SaturatingSubAssign for u64
source§fn saturating_sub_assign(&mut self, other: u64)
fn saturating_sub_assign(&mut self, other: u64)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for u128
impl SaturatingSubAssign for u128
source§fn saturating_sub_assign(&mut self, other: u128)
fn saturating_sub_assign(&mut self, other: u128)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl SaturatingSubAssign for usize
impl SaturatingSubAssign for usize
source§fn saturating_sub_assign(&mut self, other: usize)
fn saturating_sub_assign(&mut self, other: usize)
Subtracts a number by another number in place, saturating at the numeric bounds instead of overflowing.
$$
x \gets \begin{cases}
x - y & \text{if} \quad m \leq x - y \leq M, \\
M & \text{if} \quad x - y > M, \\
m & \text{if} \quad x - y < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.