changeset 64163:f3c30d255a4d

(math-apply-units): Change the places in which units are simplified.
author Jay Belanger <jay.p.belanger@gmail.com>
date Fri, 08 Jul 2005 04:32:51 +0000
parents d8358499671a
children 92457803f3c0
files lisp/calc/calc-units.el
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-units.el	Fri Jul 08 02:23:51 2005 +0000
+++ b/lisp/calc/calc-units.el	Fri Jul 08 04:32:51 2005 +0000
@@ -810,10 +810,10 @@
 	    (mapcar 'math-to-standard-rec (cdr expr))))))
 
 (defun math-apply-units (expr units ulist &optional pure)
+  (setq expr (math-simplify-units expr))
   (if ulist
       (let ((new 0)
 	    value)
-	(setq expr (math-simplify-units expr))
 	(or (math-numberp expr)
 	    (error "Incompatible units"))
 	(while (cdr ulist)
@@ -826,9 +826,9 @@
 		ulist (cdr ulist)))
 	(math-add new (math-mul (math-div expr (nth 1 (car ulist)))
 				(car (car ulist)))))
-    (math-simplify-units (if pure
-			     expr
-			   (list '* expr units)))))
+    (if pure
+        expr
+      (math-simplify-units (list '* expr units)))))
 
 (defvar math-decompose-units-cache nil)
 (defun math-decompose-units (units)