pub fn sqrt<T: PrimInt + CheckedShl + CheckedShr>(radicand: T) -> Option<T>
Expand description
Calculate square root of the given number
Code lovingly adapted from the excellent work at:
https://github.com/derekdreery/integer-sqrt-rs
The algorithm is based on the implementation in:
https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_(base_2)