Trait malachite_base::num::arithmetic::traits::SaturatingSubMul
source · [−]pub trait SaturatingSubMul<Y = Self, Z = Self> {
type Output;
fn saturating_sub_mul(self, y: Y, z: Z) -> Self::Output;
}
Expand description
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
Required Associated Types
Required Methods
fn saturating_sub_mul(self, y: Y, z: Z) -> Self::Output
Implementations on Foreign Types
sourceimpl SaturatingSubMul<u8, u8> for u8
impl SaturatingSubMul<u8, u8> for u8
sourcefn saturating_sub_mul(self, y: u8, z: u8) -> u8
fn saturating_sub_mul(self, y: u8, z: u8) -> u8
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u8
sourceimpl SaturatingSubMul<u16, u16> for u16
impl SaturatingSubMul<u16, u16> for u16
sourcefn saturating_sub_mul(self, y: u16, z: u16) -> u16
fn saturating_sub_mul(self, y: u16, z: u16) -> u16
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u16
sourceimpl SaturatingSubMul<u32, u32> for u32
impl SaturatingSubMul<u32, u32> for u32
sourcefn saturating_sub_mul(self, y: u32, z: u32) -> u32
fn saturating_sub_mul(self, y: u32, z: u32) -> u32
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u32
sourceimpl SaturatingSubMul<u64, u64> for u64
impl SaturatingSubMul<u64, u64> for u64
sourcefn saturating_sub_mul(self, y: u64, z: u64) -> u64
fn saturating_sub_mul(self, y: u64, z: u64) -> u64
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u64
sourceimpl SaturatingSubMul<u128, u128> for u128
impl SaturatingSubMul<u128, u128> for u128
sourcefn saturating_sub_mul(self, y: u128, z: u128) -> u128
fn saturating_sub_mul(self, y: u128, z: u128) -> u128
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u128
sourceimpl SaturatingSubMul<usize, usize> for usize
impl SaturatingSubMul<usize, usize> for usize
sourcefn saturating_sub_mul(self, y: usize, z: usize) -> usize
fn saturating_sub_mul(self, y: usize, z: usize) -> usize
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = usize
sourceimpl SaturatingSubMul<i8, i8> for i8
impl SaturatingSubMul<i8, i8> for i8
sourcefn saturating_sub_mul(self, y: i8, z: i8) -> i8
fn saturating_sub_mul(self, y: i8, z: i8) -> i8
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i8
sourceimpl SaturatingSubMul<i16, i16> for i16
impl SaturatingSubMul<i16, i16> for i16
sourcefn saturating_sub_mul(self, y: i16, z: i16) -> i16
fn saturating_sub_mul(self, y: i16, z: i16) -> i16
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i16
sourceimpl SaturatingSubMul<i32, i32> for i32
impl SaturatingSubMul<i32, i32> for i32
sourcefn saturating_sub_mul(self, y: i32, z: i32) -> i32
fn saturating_sub_mul(self, y: i32, z: i32) -> i32
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i32
sourceimpl SaturatingSubMul<i64, i64> for i64
impl SaturatingSubMul<i64, i64> for i64
sourcefn saturating_sub_mul(self, y: i64, z: i64) -> i64
fn saturating_sub_mul(self, y: i64, z: i64) -> i64
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i64
sourceimpl SaturatingSubMul<i128, i128> for i128
impl SaturatingSubMul<i128, i128> for i128
sourcefn saturating_sub_mul(self, y: i128, z: i128) -> i128
fn saturating_sub_mul(self, y: i128, z: i128) -> i128
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i128
sourceimpl SaturatingSubMul<isize, isize> for isize
impl SaturatingSubMul<isize, isize> for isize
sourcefn saturating_sub_mul(self, y: isize, z: isize) -> isize
fn saturating_sub_mul(self, y: isize, z: isize) -> isize
Subtracts a number by the product of two other numbers, saturating at the numeric bounds instead of overflowing.
$$
f(x, y, z) = \begin{cases}
x - yz & \text{if} \quad m \leq x - yz \leq M, \\
M & \text{if} \quad x - yz > M, \\
m & \text{if} \quad x - yz < m,
\end{cases}
$$
where $m$ is Self::MIN
and $M$ is Self::MAX
.
Worst-case complexity
Constant time and additional memory.
Examples
See here.