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

Implementations on Foreign Types

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

Implementors