[]Trait sp_runtime::traits::IntegerSquareRoot

pub trait IntegerSquareRoot {
    fn integer_sqrt_checked(&self) -> Option<Self>;

    fn integer_sqrt(&self) -> Self { ... }
}

A trait implementing integer square root.

Required methods

fn integer_sqrt_checked(&self) -> Option<Self>

Find the integer square root, returning None if the number is negative (this can never happen for unsigned types).

Loading content...

Provided methods

fn integer_sqrt(&self) -> Self

Find the integer square root.

See Integer_square_root on wikipedia for more information (and also the source of this algorithm)

Panics

For negative numbers (i family) this function will panic on negative input

Loading content...

Implementations on Foreign Types

impl IntegerSquareRoot for i64

impl IntegerSquareRoot for u128

impl IntegerSquareRoot for u16

impl IntegerSquareRoot for u32

impl IntegerSquareRoot for i16

impl IntegerSquareRoot for usize

impl IntegerSquareRoot for u64

impl IntegerSquareRoot for u8

impl IntegerSquareRoot for i128

impl IntegerSquareRoot for isize

impl IntegerSquareRoot for i32

impl IntegerSquareRoot for i8

Loading content...

Implementors

Loading content...