Function: math-find-compatible-unit-rec

math-find-compatible-unit-rec is a byte-compiled function defined in calc-units.el.gz.

Signature

(math-find-compatible-unit-rec EXPR POW)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-units.el.gz
(defun math-find-compatible-unit-rec (expr pow)
  (cond ((eq (car-safe expr) '*)
	 (or (math-find-compatible-unit-rec (nth 1 expr) pow)
	     (math-find-compatible-unit-rec (nth 2 expr) pow)))
	((eq (car-safe expr) '/)
	 (or (math-find-compatible-unit-rec (nth 1 expr) pow)
	     (math-find-compatible-unit-rec (nth 2 expr) (- pow))))
	((eq (car-safe expr) 'neg)
	 (math-find-compatible-unit-rec (nth 1 expr) pow))
	((and (eq (car-safe expr) '^)
	      (integerp (nth 2 expr)))
	 (math-find-compatible-unit-rec (nth 1 expr) (* pow (nth 2 expr))))
	(t
	 (let ((u2 (math-check-unit-name expr)))
	   (if (equal (nth 4 math-fcu-u) (nth 4 u2))
	       (cons expr pow))))))