Function: math-nearly-equal-float
math-nearly-equal-float is an autoloaded and byte-compiled function
defined in calc-math.el.gz.
Signature
(math-nearly-equal-float A B)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-math.el.gz
;;; True if A and B differ only in the last digit of precision. [P F F]
(defun math-nearly-equal-float (a b)
(let ((ediff (- (nth 2 a) (nth 2 b))))
(cond ((= ediff 0) ;; Expanded out for speed
(setq ediff (math-add (Math-integer-neg (nth 1 a)) (nth 1 b)))
(or (eq ediff 0)
(and (not (consp ediff))
(< ediff 10)
(> ediff -10)
(= (math-numdigs (nth 1 a)) calc-internal-prec))))
((= ediff 1)
(setq ediff (math-add (Math-integer-neg (nth 1 b))
(math-scale-int (nth 1 a) 1)))
(and (not (consp ediff))
(< ediff 10)
(> ediff -10)
(= (math-numdigs (nth 1 b)) calc-internal-prec)))
((= ediff -1)
(setq ediff (math-add (Math-integer-neg (nth 1 a))
(math-scale-int (nth 1 b) 1)))
(and (not (consp ediff))
(< ediff 10)
(> ediff -10)
(= (math-numdigs (nth 1 a)) calc-internal-prec))))))