summaryrefslogtreecommitdiff
path: root/lisp/calc
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2007-12-31 02:40:18 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2007-12-31 02:40:18 +0000
commita34f800f0225c82bbc9676c8f3282b63336ec566 (patch)
treee8d8e591a337dbb607c179588641d72571615add /lisp/calc
parenta271e124f4800e22a58efbf2fd001dafeb3101cc (diff)
downloademacs-a34f800f0225c82bbc9676c8f3282b63336ec566.tar.gz
(calc-convert-temperature): Ensure that units are on the result
even when the result is zero.
Diffstat (limited to 'lisp/calc')
-rw-r--r--lisp/calc/calc-units.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index a7c4b20e30d..ac1c0cd0080 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -491,9 +491,14 @@ If EXPR is nil, return nil."
(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)