This PR removes the square-root operations on floating-point numbers, which require a conversion to floating-point numbers and then back.
Instead, an integer square-root function is introduced and used. The function has the following property:
If y = integer_sqrt(x), then y*y <= x and (y+1) * (y+1) > x.
It is worth noting that the square-root function over real numbers doesn't have this property, so the new function is in some sense more precise.
This PR removes the square-root operations on floating-point numbers, which require a conversion to floating-point numbers and then back. Instead, an integer square-root function is introduced and used. The function has the following property: If
y = integer_sqrt(x)
, theny*y <= x
and(y+1) * (y+1) > x
.It is worth noting that the square-root function over real numbers doesn't have this property, so the new function is in some sense more precise.