From 76bc2ec7dc90ff0514b090a9801e71a3e92a740a Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sat, 19 May 2012 09:59:47 -0500 Subject: [PATCH] * calc/calc-units.el (math-consistent-units-p): Accept unit systems as consistent units. --- lisp/calc/calc-units.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el index 6d876cf79ba..e5c7b6737fb 100644 --- a/lisp/calc/calc-units.el +++ b/lisp/calc/calc-units.el @@ -921,9 +921,12 @@ If EXPR is nil, return nil." (math-single-units-in-expr-p (nth 1 expr)))) (t 'wrong))) -(defun math-consistent-units-p (expr1 expr2) - "Non-nil if EXPR1 and EXPR2 have consistent units." - (math-numberp (math-get-units (list '/ expr1 expr2)))) +(defun math-consistent-units-p (expr newunits) + "Non-nil if EXPR and NEWUNITS have consistent units." + (or + (and (eq (car-safe newunits) 'var) + (assq (nth 1 newunits) math-standard-units-systems)) + (math-numberp (math-get-units (list '/ expr newunits))))) (defun math-check-unit-consistency (expr units) "Give an error if EXPR and UNITS do not have consistent units." -- 2.39.2