Function: math-add-symb-fancy
math-add-symb-fancy is an autoloaded and byte-compiled function
defined in calc-arith.el.gz.
Signature
(math-add-symb-fancy A B)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-arith.el.gz
(defun math-add-symb-fancy (a b)
(or (and math-simplify-only
(not (equal a math-simplify-only))
(list '+ a b))
(and (eq (car-safe b) '+)
(math-add (math-add a (nth 1 b))
(nth 2 b)))
(and (eq (car-safe b) '-)
(math-sub (math-add a (nth 1 b))
(nth 2 b)))
(and (eq (car-safe b) 'neg)
(eq (car-safe (nth 1 b)) '+)
(math-sub (math-sub a (nth 1 (nth 1 b)))
(nth 2 (nth 1 b))))
(and (or (and (Math-vectorp a) (math-known-scalarp b))
(and (Math-vectorp b) (math-known-scalarp a)))
(math-map-vec-2 'math-add a b))
(let ((inf (math-infinitep a)))
(cond
(inf
(let ((inf2 (math-infinitep b)))
(if inf2
(if (or (memq (nth 2 inf) '(var-uinf var-nan))
(memq (nth 2 inf2) '(var-uinf var-nan)))
'(var nan var-nan)
(let ((dir (math-infinite-dir a inf))
(dir2 (math-infinite-dir b inf2)))
(if (and (Math-objectp dir) (Math-objectp dir2))
(if (Math-equal dir dir2)
a
'(var nan var-nan)))))
(if (and (equal a '(var inf var-inf))
(eq (car-safe b) 'intv)
(memq (nth 1 b) '(2 3))
(equal (nth 2 b) '(neg (var inf var-inf))))
(list 'intv 3 (nth 2 b) a)
(if (and (equal a '(neg (var inf var-inf)))
(eq (car-safe b) 'intv)
(memq (nth 1 b) '(1 3))
(equal (nth 3 b) '(var inf var-inf)))
(list 'intv 3 a (nth 3 b))
a)))))
((math-infinitep b)
(if (eq (car-safe a) 'intv)
(math-add b a)
b))
((eq (car-safe a) '+)
(let ((temp (math-combine-sum (nth 2 a) b nil nil t)))
(and temp
(math-add (nth 1 a) temp))))
((eq (car-safe a) '-)
(let ((temp (math-combine-sum (nth 2 a) b t nil t)))
(and temp
(math-add (nth 1 a) temp))))
((and (Math-objectp a) (Math-objectp b))
nil)
(t
(math-combine-sum a b nil nil nil))))
(and (Math-looks-negp b)
(list '- a (math-neg b)))
(and (Math-looks-negp a)
(list '- b (math-neg a)))
(and (eq (car-safe a) 'calcFunc-idn)
(= (length a) 2)
(or (and (eq (car-safe b) 'calcFunc-idn)
(= (length b) 2)
(list 'calcFunc-idn (math-add (nth 1 a) (nth 1 b))))
(and (math-square-matrixp b)
(math-add (math-mimic-ident (nth 1 a) b) b))
(and (math-known-scalarp b)
(math-add (nth 1 a) b))))
(and (eq (car-safe b) 'calcFunc-idn)
(= (length b) 2)
(or (and (math-square-matrixp a)
(math-add a (math-mimic-ident (nth 1 b) a)))
(and (math-known-scalarp a)
(math-add a (nth 1 b)))))
(list '+ a b)))