Function: cl-isqrt
cl-isqrt is an autoloaded and byte-compiled function defined in
cl-extra.el.gz.
Signature
(cl-isqrt X)
Documentation
Return the integer square root of the (integer) argument X.
Aliases
isqrt (obsolete since 27.1)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
;;;###autoload
(defun cl-isqrt (x)
"Return the integer square root of the (integer) argument X."
(if (and (integerp x) (> x 0))
(let ((g (ash 2 (/ (logb x) 2)))
g2)
(while (< (setq g2 (/ (+ g (/ x g)) 2)) g)
(setq g g2))
g)
(if (eq x 0) 0 (signal 'arith-error nil))))