Trait malachite_base::num::arithmetic::traits::OverflowingSquare
source · [−]pub trait OverflowingSquare {
type Output;
fn overflowing_square(self) -> (Self::Output, bool);
}
Expand description
Squares a number.
Returns a tuple of the sum along with a boolean indicating whether an arithmetic overflow occurred. If an overflow occurred, then the wrapped number is returned.
Required Associated Types
Required Methods
fn overflowing_square(self) -> (Self::Output, bool)
Implementations on Foreign Types
sourceimpl OverflowingSquare for u8
impl OverflowingSquare for u8
sourcefn overflowing_square(self) -> (u8, bool)
fn overflowing_square(self) -> (u8, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u8
sourceimpl OverflowingSquare for u16
impl OverflowingSquare for u16
sourcefn overflowing_square(self) -> (u16, bool)
fn overflowing_square(self) -> (u16, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u16
sourceimpl OverflowingSquare for u32
impl OverflowingSquare for u32
sourcefn overflowing_square(self) -> (u32, bool)
fn overflowing_square(self) -> (u32, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u32
sourceimpl OverflowingSquare for u64
impl OverflowingSquare for u64
sourcefn overflowing_square(self) -> (u64, bool)
fn overflowing_square(self) -> (u64, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u64
sourceimpl OverflowingSquare for u128
impl OverflowingSquare for u128
sourcefn overflowing_square(self) -> (u128, bool)
fn overflowing_square(self) -> (u128, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = u128
sourceimpl OverflowingSquare for usize
impl OverflowingSquare for usize
sourcefn overflowing_square(self) -> (usize, bool)
fn overflowing_square(self) -> (usize, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = usize
sourceimpl OverflowingSquare for i8
impl OverflowingSquare for i8
sourcefn overflowing_square(self) -> (i8, bool)
fn overflowing_square(self) -> (i8, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i8
sourceimpl OverflowingSquare for i16
impl OverflowingSquare for i16
sourcefn overflowing_square(self) -> (i16, bool)
fn overflowing_square(self) -> (i16, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i16
sourceimpl OverflowingSquare for i32
impl OverflowingSquare for i32
sourcefn overflowing_square(self) -> (i32, bool)
fn overflowing_square(self) -> (i32, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i32
sourceimpl OverflowingSquare for i64
impl OverflowingSquare for i64
sourcefn overflowing_square(self) -> (i64, bool)
fn overflowing_square(self) -> (i64, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i64
sourceimpl OverflowingSquare for i128
impl OverflowingSquare for i128
sourcefn overflowing_square(self) -> (i128, bool)
fn overflowing_square(self) -> (i128, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
type Output = i128
sourceimpl OverflowingSquare for isize
impl OverflowingSquare for isize
sourcefn overflowing_square(self) -> (isize, bool)
fn overflowing_square(self) -> (isize, bool)
Squares a number.
Returns a tuple containing the result and a boolean indicating whether an arithmetic occurred. If an overflow occurred, then the wrapped value is returned.
Worst-case complexity
Constant time and additional memory.
Examples
See here.