Subject: bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc)

From: Jay Belanger <[email-masked]>
Date: Fri, 20 Jan 2012 18:00:39 -0600

> Great, thanks! Do you also see a possiblity to implement the other
> scheme I suggested (attached below once more)? That would be
> wonderful!
...
>     - if the old expression has units that cancel completely (e.g.,
>       as in my orginal bug report) or it has a unit like "alpha",
>       one can specify "1" as the new unit and the unit conversion
>       returns a plain number.

If the "error if the units don't match" option is chosen, I would think
this would naturally be the default.  If partial conversions are
allowed, I don't think "1" as a unit should trigger an error, but I
think it should still be a no-op.

>     - similarly: if the old expression is just a number (i.e., unit
>       "1"), this can be converted to other dimensionless units such
>       as "alpha" without being asked for the old unit.

This I'm not too sure about.  The current behavior allows the user to
convert units without having the units explicit in the expression, so for
example
  45 u c mi/hr RET km/hr
would convert 45 mi/hr to km/hr.  This, I believe, was put in as a
feature, not a bug.

>       (Yes, I am irritated if calc-convert-units asks me about the
>       old unit if there is just a plain number on the stack. So
>       backward compatibility would probably require a variable such
>       as calc-treat-numbers-as-dimensional, bound to nil by
>       default.)

An option might be reasonable, with the current behavior the default.
But this would only be useful when changing a number to a dimensionless
quantity, like alpha, it seems.

> (2) The old expression is not dimensionless such as "7 m", the new
>     unit is "1". Here I suggest that partial conversion means to
>     return the old expression without any unit conversion.

Basically the current behavior (without the error).  But with the "need 
matching units", this should give an error.

>     (this would be quite consistent with how Calc already treats the
>     case that the old expression is something like "7 m", and the
>     new unit is "alpha".)
>
> (3) The old expression is a dimensionless number, the requested new
>     unit is something like "m":
>
>     Here I suggest to just return the old expression unmodified

Unless the "need matching units" option is chosen, in which case this
would give an error.