Function: math-add

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

Signature

(math-add A B)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc.el.gz
;;; Compute the sum of A and B.  [O O O] [Public]
(defun math-add (a b)
  (or
   (and (not (or (consp a) (consp b)))
        (+ a b))
   (and (Math-zerop a) (not (eq (car-safe a) 'mod))
	(if (and (math-floatp a) (Math-ratp b)) (math-float b) b))
   (and (Math-zerop b) (not (eq (car-safe b) 'mod))
	(if (and (math-floatp b) (Math-ratp a)) (math-float a) a))
   (and (Math-objvecp a) (Math-objvecp b)
	(or
	 (and (Math-ratp a) (Math-ratp b)
	      (require 'calc-ext)
	      (calc-add-fractions a b))
	 (and (Math-realp a) (Math-realp b)
	      (progn
		(or (and (consp a) (eq (car a) 'float))
		    (setq a (math-float a)))
		(or (and (consp b) (eq (car b) 'float))
		    (setq b (math-float b)))
		(math-add-float a b)))
	 (and (require 'calc-ext)
	      (math-add-objects-fancy a b))))
   (and (require 'calc-ext)
	(math-add-symb-fancy a b))))