Function: math-bisect-root

math-bisect-root is a byte-compiled function defined in calcalg3.el.gz.

Signature

(math-bisect-root EXPR LOW VLOW HIGH VHIGH)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calcalg3.el.gz
;;; "rtbis"  (but we should be using Brent's method)
(defun math-bisect-root (expr low _vlow high vhigh)
  (let ((step (math-sub-float high low))
	(pos (Math-posp vhigh))
	var-DUMMY
	mid vmid)
    (while (not (or (math-nearly-equal low
				       (setq step (math-mul-float
						   step '(float 5 -1))
					     mid (math-add-float low step)))
		    (progn
		      (setq var-DUMMY mid
			    vmid (math-evaluate-expr expr))
		      (Math-zerop vmid))))
      (math-working "bisect" mid)
      (if (eq (Math-posp vmid) pos)
	  (setq high mid
		vhigh vmid)
	(setq low mid
	      ;; vlow vmid
	      )))
    (list 'vec mid vmid)))