From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Roland Winkler" Newsgroups: gmane.emacs.bugs Subject: bug#10554: 24.0.92; No units specified (dimensionless quantities in Emacs Calc) Date: Fri, 20 Jan 2012 16:10:44 -0600 Message-ID: <20249.58980.778477.37221@gargle.gargle.HOWL> References: <8762g8i7s6.fsf@niu.edu> <87bopz5pt8.fsf@gmail.com> <20248.39483.716850.185512@gargle.gargle.HOWL> <87d3afdlfz.fsf@gmail.com> <20249.10002.733142.491623@gargle.gargle.HOWL> <8739bajp5k.fsf@gmail.com> <20249.43656.150957.30947@gargle.gargle.HOWL> <8739bab36p.fsf@gmail.com> <20249.52946.931367.162775@gargle.gargle.HOWL> <87lip29jsn.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1327097513 4505 80.91.229.12 (20 Jan 2012 22:11:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2012 22:11:53 +0000 (UTC) Cc: 10554@debbugs.gnu.org To: jay.p.belanger@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 20 23:11:49 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RoMgW-00067Z-S9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2012 23:11:48 +0100 Original-Received: from localhost ([::1]:38207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoMgV-0002KM-C4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Jan 2012 17:11:47 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:54655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoMgS-0002K6-8o for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 17:11:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RoMgR-00053e-6k for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 17:11:44 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoMgR-00053a-3t for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 17:11:43 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RoMhi-0006EF-8j for bug-gnu-emacs@gnu.org; Fri, 20 Jan 2012 17:13:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Roland Winkler" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Jan 2012 22:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10554 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10554-submit@debbugs.gnu.org id=B10554.132709754323882 (code B ref 10554); Fri, 20 Jan 2012 22:13:02 +0000 Original-Received: (at 10554) by debbugs.gnu.org; 20 Jan 2012 22:12:23 +0000 Original-Received: from localhost ([127.0.0.1]:37019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RoMh5-0006D6-7v for submit@debbugs.gnu.org; Fri, 20 Jan 2012 17:12:23 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]:60860) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RoMh2-0006Cy-0H for 10554@debbugs.gnu.org; Fri, 20 Jan 2012 17:12:21 -0500 Original-Received: from [83.175.202.27] (port=51023 helo=regnitz) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RoMfi-0007IT-6n; Fri, 20 Jan 2012 17:11:00 -0500 In-Reply-To: <87lip29jsn.fsf@gmail.com> X-Mailer: VM 8.2 trial under 24.0.92.1 (x86_64-unknown-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55879 Archived-At: On Fri Jan 20 2012 Jay Belanger wrote: > > 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. > > Having such an option shouldn't be too hard to take care of, after 24.1 > comes out. By default, though, the current behavior shouldn't change, > and so the option should have default value nil. Great, thanks! Do you also see a possiblity to implement the other scheme I suggested (attached below once more)? That would be wonderful! Roland 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.