Trait malachite_base::num::arithmetic::traits::WrappingAbsAssign
source · pub trait WrappingAbsAssign {
// Required method
fn wrapping_abs_assign(&mut self);
}
Expand description
Replaces a number with its absolute value, wrapping around at the boundary of the type.
Required Methods§
fn wrapping_abs_assign(&mut self)
Implementations on Foreign Types§
source§impl WrappingAbsAssign for i8
impl WrappingAbsAssign for i8
source§fn wrapping_abs_assign(&mut self)
fn wrapping_abs_assign(&mut self)
Replaces a number with its absolute value, wrapping around at the boundary of the type.
$$
x \gets \begin{cases}
|x| & \text{if} \quad x > -2^{W-1}, \\
-2^{W-1} & \text{if} \quad x = -2^{W-1},
\end{cases}
$$
where $W$ is Self::WIDTH
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl WrappingAbsAssign for i16
impl WrappingAbsAssign for i16
source§fn wrapping_abs_assign(&mut self)
fn wrapping_abs_assign(&mut self)
Replaces a number with its absolute value, wrapping around at the boundary of the type.
$$
x \gets \begin{cases}
|x| & \text{if} \quad x > -2^{W-1}, \\
-2^{W-1} & \text{if} \quad x = -2^{W-1},
\end{cases}
$$
where $W$ is Self::WIDTH
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl WrappingAbsAssign for i32
impl WrappingAbsAssign for i32
source§fn wrapping_abs_assign(&mut self)
fn wrapping_abs_assign(&mut self)
Replaces a number with its absolute value, wrapping around at the boundary of the type.
$$
x \gets \begin{cases}
|x| & \text{if} \quad x > -2^{W-1}, \\
-2^{W-1} & \text{if} \quad x = -2^{W-1},
\end{cases}
$$
where $W$ is Self::WIDTH
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl WrappingAbsAssign for i64
impl WrappingAbsAssign for i64
source§fn wrapping_abs_assign(&mut self)
fn wrapping_abs_assign(&mut self)
Replaces a number with its absolute value, wrapping around at the boundary of the type.
$$
x \gets \begin{cases}
|x| & \text{if} \quad x > -2^{W-1}, \\
-2^{W-1} & \text{if} \quad x = -2^{W-1},
\end{cases}
$$
where $W$ is Self::WIDTH
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl WrappingAbsAssign for i128
impl WrappingAbsAssign for i128
source§fn wrapping_abs_assign(&mut self)
fn wrapping_abs_assign(&mut self)
Replaces a number with its absolute value, wrapping around at the boundary of the type.
$$
x \gets \begin{cases}
|x| & \text{if} \quad x > -2^{W-1}, \\
-2^{W-1} & \text{if} \quad x = -2^{W-1},
\end{cases}
$$
where $W$ is Self::WIDTH
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
source§impl WrappingAbsAssign for isize
impl WrappingAbsAssign for isize
source§fn wrapping_abs_assign(&mut self)
fn wrapping_abs_assign(&mut self)
Replaces a number with its absolute value, wrapping around at the boundary of the type.
$$
x \gets \begin{cases}
|x| & \text{if} \quad x > -2^{W-1}, \\
-2^{W-1} & \text{if} \quad x = -2^{W-1},
\end{cases}
$$
where $W$ is Self::WIDTH
.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.