chickadee » chicken » base » exact-integer-sqrt

exact-integer-sqrt Kprocedure

Returns two values s and r, where s^2 + r = K and K < (s+1)^2. In other words, s is the closest square root we can find that's equal to or smaller than K, and r is the rest if K isn't a neat square of two numbers.

This procedure is compatible with the definition from the R7RS (scheme base) library.