diff lisp/calc/calc-units.el @ 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 819d86e241bc
children 107ccd98fa12 c938ab6810a4
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)