all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Calc: calc-convert-temperature and floating-point results
@ 2007-08-05 20:19 Christian Schlauer
  2007-08-26 13:19 ` Christian Schlauer
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Schlauer @ 2007-08-05 20:19 UTC (permalink / raw)
  To: bug-gnu-emacs

Observed with Emacs 22.1:

The following table contains some temperatures in °F in the first
column that are converted to °C in the second column with Org-mode and
the equation below the table. The third column shows what one gets
with Calc and `u t' (calc-convert-temperature) -- all converted
temperatures that should be floating point numbers aren't fully
converted: they are presented as fractions: -160:9 = -160/9 = -17.778.

| T/°F |    T/°C | T/°C (calculated in Calc with `u t') |
|------+---------+--------------------------------------|
|    0 | -17.778 |                               -160:9 |
|   32 |       0 |                                    0 |
|   50 |      10 |                                   10 |
|   70 |  21.111 |                                190:9 |
|   90 |  32.222 |                                290:9 |
| 98.6 |     37. |                                  37. |
|  212 |     100 |                                  100 |
| 1750 |  954.44 |                               8590:9 |
#+TBLFM: $2=($1-32)*5/9

How to reproduce:
-----------------

1. emacs -q --no-site-file
2. M-x calc
3. Enter the number in the first column (prepend »'« and append » dF«)
4. Press u t RET dC RET
5. What you get is the value in the 3rd column -- what you want is the
   value in the second column

Regards,

Christian Schlauer

P. S.: May I add a feature request? It would be nice if
calc-convert-temperature (and calc-convert-units) remembered the last
`target unit' requested by the user. That is, instead of the prompts
"New temperature units: " and "New units: " I would prefer "New
temperature units (default dC): " and "New units (default dC): " if
"dC" was the last `target unit' used.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Calc: calc-convert-temperature and floating-point results
  2007-08-05 20:19 Calc: calc-convert-temperature and floating-point results Christian Schlauer
@ 2007-08-26 13:19 ` Christian Schlauer
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Schlauer @ 2007-08-26 13:19 UTC (permalink / raw)
  To: bug-gnu-emacs

Christian Schlauer <cs-muelleimer-rubbish.bin@arcor.de> writes:

> Observed with Emacs 22.1:
>
> The following table contains some temperatures in °F in the first
> column that are converted to °C in the second column with Org-mode and
> the equation below the table. The third column shows what one gets
> with Calc and `u t' (calc-convert-temperature) -- all converted
> temperatures that should be floating point numbers aren't fully
> converted: they are presented as fractions: -160:9 = -160/9 = -17.778.
>
> | T/°F |    T/°C | T/°C (calculated in Calc with `u t') |
> |------+---------+--------------------------------------|
> |    0 | -17.778 |                               -160:9 |
> |   32 |       0 |                                    0 |
> |   50 |      10 |                                   10 |
> |   70 |  21.111 |                                190:9 |
> |   90 |  32.222 |                                290:9 |
> | 98.6 |     37. |                                  37. |
> |  212 |     100 |                                  100 |
> | 1750 |  954.44 |                               8590:9 |
> #+TBLFM: $2=($1-32)*5/9

This has been dealt with on the trunk -- thanks, Jay! However, it
doesn't work all the time. In fact, it seems to work only the first
time:

1. emacs -q --no-site-file
2. M-x calc
3. '0 dF RET
4. u t dF RET dC RET

So far, so good. But try to convert one more temperature:

5. '50 dF RET
6. u t RET

Now Emacs beeps and the echo area says "Bad format in units
expression: Expected a number".

Besides that, shouldn't this go into EMACS_22_BASE as well? -160:9
(°C) isn't a really convenient representation of -17.778 (°C), so it
counts as a bug fix, IMO.

> P. S.: May I add a feature request? It would be nice if
> calc-convert-temperature (and calc-convert-units) remembered the last
> `target unit' requested by the user.

Thanks for implementing this!
-- 
Christian Schlauer

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-26 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-05 20:19 Calc: calc-convert-temperature and floating-point results Christian Schlauer
2007-08-26 13:19 ` Christian Schlauer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.