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

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

Subtracts a number by the product of two other numbers, returning None if the result is not representable.

Required Associated Types

Required Methods

Implementations on Foreign Types

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad x \geq yz, \\ \operatorname{None} & \text{if} \quad x < yz, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad x \geq yz, \\ \operatorname{None} & \text{if} \quad x < yz, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad x \geq yz, \\ \operatorname{None} & \text{if} \quad x < yz, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad x \geq yz, \\ \operatorname{None} & \text{if} \quad x < yz, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad x \geq yz, \\ \operatorname{None} & \text{if} \quad x < yz, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad x \geq yz, \\ \operatorname{None} & \text{if} \quad x < yz, \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad -2^{W-1} \leq x - yz < 2^{W-1}, \\ \operatorname{None} & \text{if} \quad x - yz < -2^{W-1} \ \mathrm{or} \ xy - z \geq 2^{W-1}, \\ \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad -2^{W-1} \leq x - yz < 2^{W-1}, \\ \operatorname{None} & \text{if} \quad x - yz < -2^{W-1} \ \mathrm{or} \ xy - z \geq 2^{W-1}, \\ \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad -2^{W-1} \leq x - yz < 2^{W-1}, \\ \operatorname{None} & \text{if} \quad x - yz < -2^{W-1} \ \mathrm{or} \ xy - z \geq 2^{W-1}, \\ \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad -2^{W-1} \leq x - yz < 2^{W-1}, \\ \operatorname{None} & \text{if} \quad x - yz < -2^{W-1} \ \mathrm{or} \ xy - z \geq 2^{W-1}, \\ \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad -2^{W-1} \leq x - yz < 2^{W-1}, \\ \operatorname{None} & \text{if} \quad x - yz < -2^{W-1} \ \mathrm{or} \ xy - z \geq 2^{W-1}, \\ \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Subtracts a number by the product of two other numbers, returning None if the result cannot be represented.

$$ f(x, y, z) = \begin{cases} \operatorname{Some}(x - yz) & \text{if} \quad -2^{W-1} \leq x - yz < 2^{W-1}, \\ \operatorname{None} & \text{if} \quad x - yz < -2^{W-1} \ \mathrm{or} \ xy - z \geq 2^{W-1}, \\ \end{cases} $$ where $W$ is Self::WIDTH.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors