Trait SaturatingPowAssign

Source
pub trait SaturatingPowAssign<RHS = Self> {
    // Required method
    fn saturating_pow_assign(&mut self, exp: RHS);
}
Expand description

Raises a number to a power in place, saturating at the numeric bounds instead of overflowing.

Required Methods§

Source

fn saturating_pow_assign(&mut self, exp: RHS)

Implementations on Foreign Types§

Source§

impl SaturatingPowAssign for u64

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for i8

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for i16

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for i32

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for i64

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for i128

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for isize

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for u8

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for u16

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for u32

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for u128

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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 SaturatingPowAssign<u64> for usize

Source§

fn saturating_pow_assign(&mut self, exp: u64)

Raises a number to a power, 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.

Implementors§