|
|
|
|
|
by hansvm
1829 days ago
|
|
> What kind of savage wants the square root of an integer? It comes up moderately frequently (e.g., in prime sieves). It's usually defined as the largest integer X whose square X^2 is no greater than N. Search any sufficiently large codebase (postgres or something) and you'll probably find one or more functions called something like "isqrt". My favorite implementation just takes Newton's method and blindly applies it to integers. It happens to converge for at least one starting value. |
|