From a34f800f0225c82bbc9676c8f3282b63336ec566 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Mon, 31 Dec 2007 02:40:18 +0000 Subject: [PATCH] (calc-convert-temperature): Ensure that units are on the result even when the result is zero. --- lisp/ChangeLog | 5 +++++ lisp/calc/calc-units.el | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 35163804e3a..5a645e75e3c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2007-12-31 Jay Belanger + + * calc/calc-units.el (calc-convert-temperature): Ensure that units + are on the result even when the result is zero. + 2007-12-30 Michael Albinus * net/dbus.el (dbus-name-owner-changed-handler): Make the function 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) -- 2.39.2