pub trait SaturatingAddMul<Y = Self, Z = Self> {
    type Output;

    fn saturating_add_mul(self, y: Y, z: Z) -> Self::Output;
}
Expand description

Adds a number and the product of two other numbers, saturating at the numeric bounds instead of overflowing.

Required Associated Types

Required Methods

Implementations on Foreign Types

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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.

Adds a number and 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