changeset 87499:a0abd1e93db8

(calc-convert-temperature): Ensure that units are on the result even when the result is zero.
author Jay Belanger <jay.p.belanger@gmail.com>
date Mon, 31 Dec 2007 02:38:18 +0000
parents 566965810b9e
children 3f97647f6200
files lisp/calc/calc-units.el
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-units.el	Mon Dec 31 00:57:51 2007 +0000
+++ b/lisp/calc/calc-units.el	Mon Dec 31 02:38:18 2007 +0000
@@ -491,9 +491,14 @@
      (when (eq (car-safe unew) 'error)
        (error "Bad format in units expression: %s" (nth 2 unew)))
      (math-put-default-units unew)
-     (calc-enter-result 1 "cvtm" (math-simplify-units
-				  (math-convert-temperature expr uold unew
-							    uoldname))))))
+     (let ((ntemp (calc-normalize
+                   (math-simplify-units
+                    (math-convert-temperature expr uold unew
+                                              uoldname)))))
+       (if (Math-zerop ntemp)
+           (setq ntemp (list '* ntemp unew)))
+       (let ((calc-simplify-mode 'none))
+         (calc-enter-result 1 "cvtm" ntemp))))))
 
 (defun calc-remove-units ()
   (interactive)