Mercurial > emacs
comparison 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 |
comparison
equal
deleted
inserted
replaced
87498:566965810b9e | 87499:a0abd1e93db8 |
---|---|
489 "): ") | 489 "): ") |
490 ": ")))))) | 490 ": ")))))) |
491 (when (eq (car-safe unew) 'error) | 491 (when (eq (car-safe unew) 'error) |
492 (error "Bad format in units expression: %s" (nth 2 unew))) | 492 (error "Bad format in units expression: %s" (nth 2 unew))) |
493 (math-put-default-units unew) | 493 (math-put-default-units unew) |
494 (calc-enter-result 1 "cvtm" (math-simplify-units | 494 (let ((ntemp (calc-normalize |
495 (math-convert-temperature expr uold unew | 495 (math-simplify-units |
496 uoldname)))))) | 496 (math-convert-temperature expr uold unew |
497 uoldname))))) | |
498 (if (Math-zerop ntemp) | |
499 (setq ntemp (list '* ntemp unew))) | |
500 (let ((calc-simplify-mode 'none)) | |
501 (calc-enter-result 1 "cvtm" ntemp)))))) | |
497 | 502 |
498 (defun calc-remove-units () | 503 (defun calc-remove-units () |
499 (interactive) | 504 (interactive) |
500 (calc-slow-wrapper | 505 (calc-slow-wrapper |
501 (calc-enter-result 1 "rmun" (math-simplify-units | 506 (calc-enter-result 1 "rmun" (math-simplify-units |