Trait integer_sqrt::IntegerSquareRoot
source · [−]pub trait IntegerSquareRoot {
fn integer_sqrt_checked(&self) -> Option<Self>
where
Self: Sized;
fn integer_sqrt(&self) -> Self
where
Self: Sized,
{ ... }
}
Expand description
A trait implementing integer square root.
Required methods
fn integer_sqrt_checked(&self) -> Option<Self> where
Self: Sized,
fn integer_sqrt_checked(&self) -> Option<Self> where
Self: Sized,
Find the integer square root, returning None
if the number is negative (this can never
happen for unsigned types).
Provided methods
fn integer_sqrt(&self) -> Self where
Self: Sized,
fn integer_sqrt(&self) -> Self where
Self: Sized,
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