exact-integer-sqrt
-- r7rs
Definition procedure
;
exact-integer-sqrt
(from vonuvoli
);Procedure variants:
((exact-integer-zero) -> (exact-integer-zero exact-integer-zero))
exact-integer-zero
;exact-integer-zero
;exact-integer-zero
;((exact-integer-positive) -> (exact-integer-positive exact-integer-positive-or-zero))
exact-integer-positive
;exact-integer-positive
;exact-integer-positive-or-zero
;scheme:base
-- (scheme base)
;scheme
-- (scheme)
;(exact-integer-sqrt k)
Returns two non-negative exact integers
s
andr
wherek = s^2 + r
andk < (s+1)^2
.(exact-integer-sqrt 4) ===> 2 0 (exact-integer-sqrt 5) ===> 2 1
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.