Template Function ADS::integerSqrt

Function Documentation

template<std::unsigned_integral U>
U ADS::integerSqrt(U n)

integerSqrt(): the largest r with r^2 <= n, by a binary search with no overflow; w / 2 steps for w bits

Post:

r^2 <= n < ( r + 1 )^2