Function: math-scan-for-limits

math-scan-for-limits is a byte-compiled function defined in calcalg2.el.gz.

Signature

(math-scan-for-limits X)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calcalg2.el.gz
(defun math-scan-for-limits (x)
  (cond ((Math-primp x))
	((and (eq (car x) 'calcFunc-subscr)
	      (Math-vectorp (nth 1 x))
	      (math-expr-contains (nth 2 x) math-var))
	 (let* ((calc-next-why nil)
		(low-val (math-solve-for (nth 2 x) 1 math-var nil))
		(high-val (math-solve-for (nth 2 x) (1- (length (nth 1 x)))
					  math-var nil))
		temp)
	   ;; FIXME: The below is a no-op, but I suspect its result
	   ;; was meant to be used, tho I don't know what for.
	   ;; (and low-val (math-realp low-val)
	   ;;      high-val (math-realp high-val))
	   (and (Math-lessp high-val low-val)
		(setq temp low-val low-val high-val high-val temp))
	   (setq calc-low (math-max calc-low (math-ceiling low-val))
		 calc-high (math-min calc-high (math-floor high-val)))))
	(t
	 (while (setq x (cdr x))
	   (math-scan-for-limits (car x))))))