Function: math-isqrt

math-isqrt is a byte-compiled function defined in calc-math.el.gz.

Signature

(math-isqrt A)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-math.el.gz
;;; Compute the integer square-root floor(sqrt(A)).  A > 0.  [I I] [Public]
;;; This method takes advantage of the fact that Newton's method starting
;;; with an overestimate always works, even using truncating integer division!
(defun math-isqrt (a)
  (cond ((Math-zerop a) a)
	((not (natnump a))
	 (math-reject-arg a 'natnump))
	(t (cl-isqrt a))))