Function: calcFunc-gcd

calcFunc-gcd is an autoloaded and byte-compiled function defined in calc-comb.el.gz.

Signature

(calcFunc-gcd A B)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-comb.el.gz
(defun calcFunc-gcd (a b)
  (if (Math-messy-integerp a)
      (setq a (math-trunc a)))
  (if (Math-messy-integerp b)
      (setq b (math-trunc b)))
  (cond ((and (Math-integerp a) (Math-integerp b))
	 (math-gcd a b))
	((Math-looks-negp a)
	 (calcFunc-gcd (math-neg a) b))
	((Math-looks-negp b)
	 (calcFunc-gcd a (math-neg b)))
	((Math-zerop a) (math-abs b))
	((Math-zerop b) (math-abs a))
	((and (Math-ratp a)
	      (Math-ratp b))
	 (math-make-frac (math-gcd (if (eq (car-safe a) 'frac) (nth 1 a) a)
				   (if (eq (car-safe b) 'frac) (nth 1 b) b))
			 (calcFunc-lcm
			  (if (eq (car-safe a) 'frac) (nth 2 a) 1)
			  (if (eq (car-safe b) 'frac) (nth 2 b) 1))))
	((not (Math-integerp a))
	 (calc-record-why 'integerp a)
	 (list 'calcFunc-gcd a b))
	(t
	 (calc-record-why 'integerp b)
	 (list 'calcFunc-gcd a b))))