all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Roland Winkler" <winkler@gnu.org>
To: jay.p.belanger@gmail.com
Cc: 10554@debbugs.gnu.org
Subject: bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc)
Date: Fri, 20 Jan 2012 14:30:10 -0600	[thread overview]
Message-ID: <20249.52946.931367.162775@gargle.gargle.HOWL> (raw)
In-Reply-To: <8739bab36p.fsf@gmail.com>

On Fri Jan 20 2012 Jay Belanger wrote:
> > Here the user is posing a problem with no uniquely defined answer.
> > The answer could be expressed in km/hr but also in km/s or in km eV/hbar.
> 
> But what /should/ happen?  Would you like an error signaled?  Otherwise,
> the current behavior is the most reasonable.

I would, indeed, consider it quite OK if an error was signaled. Say,
if there was an option calc-throw-error-if-units-mismatch, I'd bind
it to t.

> >> But what if you ask Calc to convert a units expression into a
> >> dimensionless number when it can't be so converted?
> >
> > again: I'd give this scenario the lowest priority.
> 
> I'm not sure what you mean by giving it low priority. Either it
> happens or it doesn't, and Calc needs to do something if it
> happens.

I guess we can have the following scenarios that can be handled as
follows:

(1) If the old expression and the new unit have the same dimension,
    "1" should be treated like any other unit.

    So this means: 

    - 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.

    - 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.

      (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.)

(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.

    (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

    (again, this would be quite consistent with how Calc already
    treats the case that the old expression is something like
    "7 alpha", where conversion to any other unit gives a
    dimensionless number.

Did I miss another possibility? If yes, I am sure that it has a
reasonable solution, too.

(Even if Calc handled dimensionless quantities this way, I would
bind calc-throw-error-if-units-mismatch to t because in my work a
unit mismatch between old and new means a mismatch between what I
have and what I expect to get.)

Roland





  reply	other threads:[~2012-01-20 20:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-19  5:24 bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc) Roland Winkler
2012-01-19 21:45 ` Jay Belanger
2012-01-19 22:33   ` Roland Winkler
2012-01-20  4:53     ` Jay Belanger
2012-01-20  8:34       ` Roland Winkler
2012-01-20 16:48         ` Jay Belanger
2012-01-20 17:55           ` Roland Winkler
2012-01-20 19:10             ` Jay Belanger
2012-01-20 20:30               ` Roland Winkler [this message]
2012-01-20 20:54                 ` Jay Belanger
2012-01-20 22:10                   ` Roland Winkler
2012-01-21  0:00                     ` Jay Belanger
2012-01-21  9:24                       ` Roland Winkler
2012-01-21 14:45                         ` Jay Belanger
2012-01-21 15:12                           ` Roland Winkler
2012-01-21 15:28                             ` Jay Belanger
2012-01-21 15:42                         ` Jay Belanger
2012-01-21 16:03                           ` Roland Winkler
2012-01-20 20:36               ` Roland Winkler
2012-01-21  4:21 ` Jay Belanger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20249.52946.931367.162775@gargle.gargle.HOWL \
    --to=winkler@gnu.org \
    --cc=10554@debbugs.gnu.org \
    --cc=jay.p.belanger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.