]> git.eshelyaron.com Git - emacs.git/commitdiff
(math-apply-units): Change the places in which units are simplified.
authorJay Belanger <jay.p.belanger@gmail.com>
Fri, 8 Jul 2005 04:32:51 +0000 (04:32 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Fri, 8 Jul 2005 04:32:51 +0000 (04:32 +0000)
lisp/calc/calc-units.el

index 0983b807fde077b11b9ca20e8b94fde8e4572222..3857d930902a76f6fdab49dd6c7f7285e4d6ea62 100644 (file)
@@ -810,10 +810,10 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
            (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 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
                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)