From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Chris Zheng Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 05:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 41347@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15896948069853 (code B ref -1); Sun, 17 May 2020 05:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 May 2020 05:53:26 +0000 Received: from localhost ([127.0.0.1]:42171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaCEo-0002Yr-CW for submit@debbugs.gnu.org; Sun, 17 May 2020 01:53:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:41424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaCEm-0002Yj-RE for submit@debbugs.gnu.org; Sun, 17 May 2020 01:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaCEm-0000Mz-8A for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 01:53:24 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:33288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaCEl-0002ve-Du for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 01:53:23 -0400 Received: by mail-pl1-x636.google.com with SMTP id t7so2772051plr.0 for ; Sat, 16 May 2020 22:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition; bh=YuyxPvfdSPgPD6KU7NZL6M5QIHYm5hRSke6qFmyrFeA=; b=gORrYPTvLZ7TpwP3jcyNdiYQGvZIDcR0bB44oEsRxMjcQoBqLX980eWGztLVb9cRjl 8FyC539GWNRkPUUpkoMcalaS4DBpWNEGyEQ21qMUPhySNpAgyR8aeo9su+nQUrTicoP5 tDmsJSpZVpr5ur72iUigNog2fqOSvng3UxF1mmP9/Fd+fQ+Vr2s6T6gqIfuISM2M9D5s 993z9dhe7t/ZakFzrFvBRlfjeWYvdmGheqLfGcBNBP+TxFiURt0G1WKjK5wOcR7FA6tH iksFoPa19j0T85goUlzXqf3dWIUjkEJGjtiO0PNGsYDh6j8neLkYZiMtim1mdhjPEaJH vjtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=YuyxPvfdSPgPD6KU7NZL6M5QIHYm5hRSke6qFmyrFeA=; b=horfuUB0ANtILyB6L1x4QeWhi+yqCwKmjwW5tUS2ZMFfROS85EB6A+x8S3uzEb1Z+J KGj0wOYorCZUo+xb5iCtMtnhHenlpQHzbdfdTR/zutIplwi1I8pVLvbnZyu7QlUbNFXg ACmD+YcPslaP0Two10vtOVRC7ixJgLOcs2KQ5CeZHZi0WuulVSAVvNRDGD2hL0SkcxaW Ep8YPDbXNaXAlV44Xz3lK/NI2ucxE2IkCfMBracZ0Kt/i4sHX3cr5wHJxa15sv7dm/sN 9EheUnCkKPjuyqM3gL9eG9g2IDhq+SOKyXEbHKG7RgRMvBq+lFxjm0X0I9+grfEwfco5 H9AA== X-Gm-Message-State: AOAM531O9VPojXE5bXA9uK8mEfrzxOmrixtrxD6yaiEewKFExIb4pkeN wcjWsrBlLBKLpbdhQeL5KHmYa7KE X-Google-Smtp-Source: ABdhPJzG5AgFcH517BIrAfc1tBXY5buruc13kaO46hjGRWyn5pmPfgyR1m8RBLqarOPk0TE5dLxTPw== X-Received: by 2002:a17:902:bc89:: with SMTP id bb9mr10927640plb.101.1589694801158; Sat, 16 May 2020 22:53:21 -0700 (PDT) Received: from Kael ([67.230.166.176]) by smtp.gmail.com with ESMTPSA id d7sm5761045pfa.63.2020.05.16.22.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2020 22:53:20 -0700 (PDT) Date: Sun, 17 May 2020 13:53:12 +0800 From: Chris Zheng Message-ID: <20200517055312.jtwughazs453lbzt@Kael> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=chriszheng99@gmail.com; helo=mail-pl1-x636.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Hello, With current master, starting Emacs with `-Q`: 1. M-x calculator 2. Input 1e-3 RET You will get 1 instead of 0.001. I believe this happens since Emacs 26.1. The root cause is the `calculator-string-to-number` function in lisp/calculator.el. Now the function gives (calculator-string-to-number "1e-3") => 1.0 (calculator-string-to-number "1e3") => 1000.0 (calculator-string-to-number "1e") => 1.0 The funcional code is (replace-regexp-in-string "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str) It changes `1e-3` to `1e0-3` that is recognized as 1. I have a possible fix attached below. Please see if it is correct. Thank you, Chris Zheng From 7693d7072e4787c4b0663f490be5d83c1d9a6ee3 Mon Sep 17 00:00:00 2001 From: Chris Zheng Date: Sun, 17 May 2020 13:43:35 +0800 Subject: [PATCH 1/1] Fix calculator exponent input * lisp/calculator.el (calculator-string-to-number): Change the regexp to correctly deal with negative exponents. --- lisp/calculator.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/calculator.el b/lisp/calculator.el index 7e0b2fcc6a..fa3eb19099 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -863,7 +863,7 @@ calculator-string-to-number (let* ((str (replace-regexp-in-string "\\.\\([^0-9].*\\)?$" ".0\\1" str)) (str (replace-regexp-in-string - "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str))) + "[eE]\\([+-]?\\)?$" "e\\10" str))) (float (string-to-number str))))) (defun calculator-push-curnum () -- 2.16.1.windows.1 From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents References: <20200517055312.jtwughazs453lbzt@Kael> In-Reply-To: <20200517055312.jtwughazs453lbzt@Kael> Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 11:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chris Zheng Cc: 41347@debbugs.gnu.org, Eli Barzilay Received: via spool by 41347-submit@debbugs.gnu.org id=B41347.15897137187985 (code B ref 41347); Sun, 17 May 2020 11:09:02 +0000 Received: (at 41347) by debbugs.gnu.org; 17 May 2020 11:08:38 +0000 Received: from localhost ([127.0.0.1]:42410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaH9q-00024j-7c for submit@debbugs.gnu.org; Sun, 17 May 2020 07:08:38 -0400 Received: from mail78c50.megamailservers.eu ([91.136.10.88]:33702 helo=mail70c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaH9n-00024a-UN for 41347@debbugs.gnu.org; Sun, 17 May 2020 07:08:36 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1589713713; bh=URgIy9MkGwrUFwzxCZVAlegAdCDSRdPs0rquWei0w48=; h=From:Subject:Date:Cc:To:From; b=IvcZN31XTG8GpdqW8WPIk5HgbxO7CbAUXujq/cIGR9JA6WMP4BKYxq4ErQ0Y10wTz 9elsTxYmg0aUTuTeARCPlY8HHCuvcNDIDcDY0+2nehP75VRQQIpulIQgrecGfpV2NE 7EPJJuJ1GJqfCqMq7MP602G2VUNDBEjRVgS8OSEA= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail70c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04HB8V1L003784; Sun, 17 May 2020 11:08:32 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Message-Id: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> Date: Sun, 17 May 2020 13:08:30 +0200 X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F21.5EC11AD6.006D:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=OKBZIhSB c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=oRtJ5M1z6AsA:10 a=M51BFTxLslgA:10 a=GL7DKV27BmO-ERD6PO4A:9 a=f1Qf1Crwjm96na0r:21 a=yxHgqvmM-_153pdn:21 a=CjuIK1q_8ugA:10 X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: > @@ -863,7 +863,7 @@ calculator-string-to-number > (let* ((str (replace-regexp-in-string > "\\.\\([^0-9].*\\)?$" ".0\\1" str)) > (str (replace-regexp-in-string > - "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: megamailservers.eu] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) > @@ -863,7 +863,7 @@ calculator-string-to-number > (let* ((str (replace-regexp-in-string > "\\.\\([^0-9].*\\)?$" ".0\\1" str)) > (str (replace-regexp-in-string > - "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str))) > + "[eE]\\([+-]?\\)?$" "e\\10" str))) > (float (string-to-number str))))) Thanks for the report and the suggested patch! However, I'm not sure = what either of these replace-regexp-in-string calls are good for. The = first one possibly to accept 1.e23 instead of 1e23; the second one is = less clear. Frankly, I think we can drop both. Eli, do you remember? From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 11:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 41347@debbugs.gnu.org, Chris Zheng , Eli Barzilay Received: via spool by 41347-submit@debbugs.gnu.org id=B41347.158971667620698 (code B ref 41347); Sun, 17 May 2020 11:58:02 +0000 Received: (at 41347) by debbugs.gnu.org; 17 May 2020 11:57:56 +0000 Received: from localhost ([127.0.0.1]:42468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaHvY-0005Nm-LA for submit@debbugs.gnu.org; Sun, 17 May 2020 07:57:56 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:49145) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaHvW-0005Nc-PA for 41347@debbugs.gnu.org; Sun, 17 May 2020 07:57:55 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 49Q0yT0mddz1rsXX; Sun, 17 May 2020 13:57:52 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 49Q0yS5MKQz1qqkG; Sun, 17 May 2020 13:57:52 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id heV_4hmrN85v; Sun, 17 May 2020 13:57:51 +0200 (CEST) X-Auth-Info: 2jvUywQaQ4ouX1RebT67O1nzdZTaPdeRFn9uCDfxkLhfE5gZAm93FvaFWFLCl/1D Received: from igel.home (ppp-46-244-186-105.dynamic.mnet-online.de [46.244.186.105]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 17 May 2020 13:57:51 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 1AB3E2C0B37; Sun, 17 May 2020 13:57:51 +0200 (CEST) From: Andreas Schwab References: <20200517055312.jtwughazs453lbzt@Kael> <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> X-Yow: What I need is a MATURE RELATIONSHIP with a FLOPPY DISK... Date: Sun, 17 May 2020 13:57:50 +0200 In-Reply-To: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Sun, 17 May 2020 13:08:30 +0200") Message-ID: <87pnb2wz7l.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) On Mai 17 2020, Mattias EngdegÃ¥rd wrote: >> @@ -863,7 +863,7 @@ calculator-string-to-number >> (let* ((str (replace-regexp-in-string >> "\\.\\([^0-9].*\\)?$" ".0\\1" str)) >> (str (replace-regexp-in-string >> - "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str))) >> + "[eE]\\([+-]?\\)?$" "e\\10" str))) >> (float (string-to-number str))))) > > Thanks for the report and the suggested patch! However, I'm not sure what either of these replace-regexp-in-string calls are good for. The first one possibly to accept 1.e23 instead of 1e23; the second one is less clear. Frankly, I think we can drop both. In commit f248292ede, there was - ((string-match-p "[eE][+-]?$" str) (concat str "0")) so the bug is that the part matching "[+-]?" is now dropped. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 12:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andreas Schwab Cc: 41347@debbugs.gnu.org, Chris Zheng , Eli Barzilay Received: via spool by 41347-submit@debbugs.gnu.org id=B41347.158971791922651 (code B ref 41347); Sun, 17 May 2020 12:19:02 +0000 Received: (at 41347) by debbugs.gnu.org; 17 May 2020 12:18:39 +0000 Received: from localhost ([127.0.0.1]:42492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaIFa-0005tH-Ui for submit@debbugs.gnu.org; Sun, 17 May 2020 08:18:39 -0400 Received: from mail1454c50.megamailservers.eu ([91.136.14.54]:53530 helo=mail266c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaIFX-0005sp-5k for 41347@debbugs.gnu.org; Sun, 17 May 2020 08:18:36 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1589717907; bh=372DSuHudc2nYLjcsvZHfqYm+kWdc3DdlLnVGjxWR8k=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=NONk0yt/A49axLTfsJbIldrblM+bAxbcEQvYftZ3ioJ6+eisAEMfuV0u0OGD+j4XX 0cynpqOUY5tqsCCYKIDhoDQ8FbTYGJirJWFZ00lT9bAQGahnnB2G8Z3ZgQmraOcAIM 2JN7TOXm5Cfyn6Cwa5UqOZOG8P5U2ejQd1k0k3jQ= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail266c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04HCIO3v024982; Sun, 17 May 2020 12:18:26 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: <87pnb2wz7l.fsf@igel.home> Date: Sun, 17 May 2020 14:18:24 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20200517055312.jtwughazs453lbzt@Kael> <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> <87pnb2wz7l.fsf@igel.home> X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F15.5EC12B45.003B:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=A5MSwJeG c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=tBb2bbeoAAAA:8 a=56vS-mUpp_CWYhKZYgkA:9 a=-s1fOsTYrStDfpAJ:21 a=LmbwT2T2-OpEQ2UL:21 a=CjuIK1q_8ugA:10 a=Oj-tNtZlA1e06AYgeCfH:22 X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 17 maj 2020 kl. 13.57 skrev Andreas Schwab : > In commit f248292ede, there was > > - ((string-match-p "[eE][+-]?$" str) (concat str "0")) > > so the bug is that the part matching "[+-]?" is now dropped. Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: megamailservers.eu] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) 17 maj 2020 kl. 13.57 skrev Andreas Schwab : > In commit f248292ede, there was >=20 > - ((string-match-p "[eE][+-]?$" str) (concat str "0")) >=20 > so the bug is that the part matching "[+-]?" is now dropped. In the commit you refer to, read-from-string was used; a partial input = like "1e" had to be completed with an extra "0" to make the result a = (floating-point) number. This no longer appears necessary since we use = string-to-number and convert integers to float. From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Eli Barzilay Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 20:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 41347@debbugs.gnu.org, Chris Zheng Received: via spool by 41347-submit@debbugs.gnu.org id=B41347.158974721812904 (code B ref 41347); Sun, 17 May 2020 20:27:02 +0000 Received: (at 41347) by debbugs.gnu.org; 17 May 2020 20:26:58 +0000 Received: from localhost ([127.0.0.1]:44871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaPsA-0003M4-2T for submit@debbugs.gnu.org; Sun, 17 May 2020 16:26:58 -0400 Received: from mail-ed1-f47.google.com ([209.85.208.47]:36338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaPs8-0003Ls-Uo for 41347@debbugs.gnu.org; Sun, 17 May 2020 16:26:57 -0400 Received: by mail-ed1-f47.google.com with SMTP id b91so6744507edf.3 for <41347@debbugs.gnu.org>; Sun, 17 May 2020 13:26:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=barzilay-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=WfD/oVzak5YEKYXXg18yGDvN9E+Qv07JlKH6fsSiTdE=; b=xBaEIo2cX5aJC+1dSD6K/916sPCumzRW3y6SBFH0U07JZxF38rNl4fCrL287EFkGZA zMQtFvIyBlXLZh/xDpP3sX4+ku2Dy3ej+bdCgQIyOJ3mQPuH/CFWA19kaN+pc9dpXnyQ 4PF3bUcBDanWTolxy/x4Z5Q/mVtrDiZmMSabHxqZTxC9vzznEGipNEbdhOcZzdgnUqcF LT9M/WjNHr1fPOZ+I/kHfomM8XsP/v2IdgilkDuPauL21gkf7x8jjUDyJrNjCVA6U7L5 agi2Tp9xIJsno2AhoDVM83EvHc/Mr+B0Vt8my1yf3+SFH0SM0V3r1D7IDmmRO4QL9pOk SSBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=WfD/oVzak5YEKYXXg18yGDvN9E+Qv07JlKH6fsSiTdE=; b=rIcaVK/EtcHz6/4QQGe/4wbnicDgTNZy1FS60A4r8O3ZVFyNeXJ4UnCp3TKU2Mm42c Aivxy9He5r9o3J/GH5yZ/Ymm0eoup4h7e6Pexg7aiN89Y0meE+NRp1MPsbyuiGiEYY0C f6yL+80huA16rEkeTXfhsBjAX72wr6hiHZR6zARFoNuzqE6bgUapAn7sFZlZUsh+RVuX W48mrfzB74y5AalHvUHL1pNUIXSrPx31LACzEf/Z9rhOc+DgtNxn3CkGvMGB02PZJd38 j7MzzwpccKM3q5vsaq6Tr26b3I+6nuinsbrUzRb0ABZgxLDJt8vR+JX51BVMS5YkL1Dg T14g== X-Gm-Message-State: AOAM533JvIOP+sCmD/ZYL9r4Kx6LoOORpoQgD4wP30gS7jF6aEZvHYSg 0KhhDuWMzW4SnWRjamhUch6nZ0ZJ1dY/vgI3PUU9zQ== X-Google-Smtp-Source: ABdhPJwL/0sdrPHwnRtbjSQG2nSirRwjL3LVNM5ND96mqdcpHo6KhG8EE1HFsrle4FpZnYS5yI2rXsPGZnC+viPsR/M= X-Received: by 2002:a50:fa85:: with SMTP id w5mr2985749edr.88.1589747210930; Sun, 17 May 2020 13:26:50 -0700 (PDT) MIME-Version: 1.0 References: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> In-Reply-To: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> From: Eli Barzilay Date: Sun, 17 May 2020 16:26:39 -0400 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) On Sun, May 17, 2020 at 7:08 AM Mattias Engdeg=C3=A5rd w= rote: > > > @@ -863,7 +863,7 @@ calculator-string-to-number > > (let* ((str (replace-regexp-in-string > > "\\.\\([^0-9].*\\)?$" ".0\\1" str)) > > (str (replace-regexp-in-string > > - "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str))) > > + "[eE]\\([+-]?\\)?$" "e\\10" str))) > > (float (string-to-number str))))) > > Thanks for the report and the suggested patch! However, I'm not sure > what either of these replace-regexp-in-string calls are good for. The > first one possibly to accept 1.e23 instead of 1e23; the second one is > less clear. Frankly, I think we can drop both. > > Eli, do you remember? Sidenote: there's not much point in the double "?" in "\\([+-]?\\)?". But more to the point, I don't remember why I switched to the regexp mess in the first place. The original code: (car (read-from-string (cond ((equal "." str) "0.0") ((string-match "[eE][+-]?$" str) (concat str "0")) ((string-match "\\.[0-9]\\|[eE]" str) str) ((string-match "\\." str) ;; do this because Emacs reads "23." as an integer (concat str "0")) ((stringp str) (concat str ".0")) (t "0.0")))) makes the intention clear -- the idea is to mimic common calculators where you can type "3." or "3e" and get 3. (Re the fix from a short while ago, the comment also shows that the original intention was to always get a float.) It looks like going back to a simplified (due to the float) version of this would be better. Also testing that the thing I mentioned in the log still works ("e+" using "+" as an operator). --=20 ((x=3D>x(x))(x=3D>x(x))) Eli Barzilay: http://barzilay.org/ Maze is Life! From unknown Sun Jun 22 04:23:21 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Chris Zheng Subject: bug#41347: closed (Re: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents ) Message-ID: References: <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> <20200517055312.jtwughazs453lbzt@Kael> X-Gnu-PR-Message: they-closed 41347 X-Gnu-PR-Package: emacs Reply-To: 41347@debbugs.gnu.org Date: Mon, 18 May 2020 09:29:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1589794142-8840-1" This is a multi-part message in MIME format... ------------=_1589794142-8840-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #41347: 28.0.50; calculator.el: Cannot input negative exponents which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 41347@debbugs.gnu.org. --=20 41347: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D41347 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1589794142-8840-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 41347-done) by debbugs.gnu.org; 18 May 2020 09:28:30 +0000 Received: from localhost ([127.0.0.1]:45911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jac4U-0002Hm-9Y for submit@debbugs.gnu.org; Mon, 18 May 2020 05:28:30 -0400 Received: from mail157c50.megamailservers.eu ([91.136.10.167]:56538 helo=mail51c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jac4R-0002Hb-1z for 41347-done@debbugs.gnu.org; Mon, 18 May 2020 05:28:28 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1589794104; bh=eIeRZ6c5be0ZuyP/LNv7kIez18vyybQxGyeX1IgsS9c=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=OQ2x1eTBOp5J7fqEiN0qPbtPH3VkL6bFHFQpTa+bSwxB8/v9FT3qn61v/swjgEUGv eZ7Tkt2YGUAR6m9jROq4JtuwVPgCLqDQPqxj7gAv/fMbBE24MxK6QKQdg/kEoHG3Bl 29yPSrtVvNQV0++dkqJlsYKZppyjZSA1jk1tzeqs= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail51c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04I9SM2B017695; Mon, 18 May 2020 09:28:23 +0000 From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Message-Id: <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> Content-Type: multipart/mixed; boundary="Apple-Mail=_24B401BB-4062-49FC-9713-FB7B92A3D9A4" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Subject: Re: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Date: Mon, 18 May 2020 11:28:21 +0200 In-Reply-To: To: Eli Barzilay References: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F1A.5EC254EA.0039:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=MOMeZ/Rl c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=_MzN3rHgAAAA:8 a=qB_FPJd66z8_ubUs-1oA:9 a=CjuIK1q_8ugA:10 a=xx2g9Q9Gyu3bog0EgxsA:9 a=B2y7HmGcmWMA:10 a=5BNEB7gNdRn6NHbpoR6W:22 X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 17 maj 2020 kl. 22.26 skrev Eli Barzilay : > the idea is to mimic common calculators > where you can type "3." or "3e" and get 3. Thank you Eli! I can confirm that after removing all the string transformation prior to the call to string-to-number, everything works as expected except "1.e3" (dot before E). A single transformation [...] Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: megamailservers.eu] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 41347-done Cc: 41347-done@debbugs.gnu.org, Chris Zheng X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_24B401BB-4062-49FC-9713-FB7B92A3D9A4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 17 maj 2020 kl. 22.26 skrev Eli Barzilay : > the idea is to mimic common calculators > where you can type "3." or "3e" and get 3. Thank you Eli! I can confirm that after removing all the string = transformation prior to the call to string-to-number, everything works = as expected except "1.e3" (dot before E). A single transformation taking = care of that case was added for the sake of completeness. The attached patch has now been pushed to master. --Apple-Mail=_24B401BB-4062-49FC-9713-FB7B92A3D9A4 Content-Disposition: attachment; filename=0001-Fix-calculator-entry-of-numbers-with-negative-expone.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fix-calculator-entry-of-numbers-with-negative-expone.patch" Content-Transfer-Encoding: quoted-printable =46rom=20482baa9856e4269bdf8f253621013592bc8de5b2=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Sun,=2017=20May=202020=2018:11:27=20+0200=0A= Subject:=20[PATCH]=20Fix=20calculator=20entry=20of=20numbers=20with=20= negative=20exponents=0A=20(bug#41347)=0A=0A*=20lisp/calculator.el=20= (calculator-string-to-number):=0ARemove=20obsolete=20string=20= transformations=20preventing=20entry=20of=201e-3=20etc.=0AKeep=20one=20= transformation=20to=20allow=20entry=20of=20"1.e3".=0AReported=20by=20= Chris=20Zheng.=0A---=0A=20lisp/calculator.el=20|=2010=20++++------=0A=20= 1=20file=20changed,=204=20insertions(+),=206=20deletions(-)=0A=0Adiff=20= --git=20a/lisp/calculator.el=20b/lisp/calculator.el=0Aindex=20= 7e0b2fcc6a..cd92f99268=20100644=0A---=20a/lisp/calculator.el=0A+++=20= b/lisp/calculator.el=0A@@=20-858,12=20+858,10=20@@=20= calculator-string-to-number=0A=20=20=20"Convert=20the=20given=20STR=20to=20= a=20number,=20according=20to=20the=20value=20of=0A=20= `calculator-input-radix'."=0A=20=20=20(if=20calculator-input-radix=0A-=20= =20=20=20(string-to-number=20str=20(cadr=20(assq=20= calculator-input-radix=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20'((bin=20= 2)=20(oct=208)=20(hex=2016)))))=0A-=20=20=20=20(let*=20((str=20= (replace-regexp-in-string=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20"\\.\\([^0-9].*\\)?$"=20".0\\1"=20str))=0A-=20=20=20=20=20=20=20=20= =20=20=20(str=20(replace-regexp-in-string=0A-=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20"[eE][+-]?\\([^0-9].*\\)?$"=20"e0\\1"=20str)))=0A+=20= =20=20=20=20=20(string-to-number=20str=20(cadr=20(assq=20= calculator-input-radix=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= '((bin=202)=20(oct=208)=20(hex=2016)))))=0A+=20=20=20=20;;=20Allow=20= entry=20of=20"1.e3".=0A+=20=20=20=20(let=20((str=20= (replace-regexp-in-string=20(rx=20"."=20(any=20"eE"))=20"e"=20str)))=0A=20= =20=20=20=20=20=20(float=20(string-to-number=20str)))))=0A=20=0A=20= (defun=20calculator-push-curnum=20()=0A--=20=0A2.21.1=20(Apple=20= Git-122.3)=0A=0A= --Apple-Mail=_24B401BB-4062-49FC-9713-FB7B92A3D9A4-- ------------=_1589794142-8840-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 17 May 2020 05:53:26 +0000 Received: from localhost ([127.0.0.1]:42171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaCEo-0002Yr-CW for submit@debbugs.gnu.org; Sun, 17 May 2020 01:53:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:41424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaCEm-0002Yj-RE for submit@debbugs.gnu.org; Sun, 17 May 2020 01:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaCEm-0000Mz-8A for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 01:53:24 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:33288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaCEl-0002ve-Du for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 01:53:23 -0400 Received: by mail-pl1-x636.google.com with SMTP id t7so2772051plr.0 for ; Sat, 16 May 2020 22:53:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition; bh=YuyxPvfdSPgPD6KU7NZL6M5QIHYm5hRSke6qFmyrFeA=; b=gORrYPTvLZ7TpwP3jcyNdiYQGvZIDcR0bB44oEsRxMjcQoBqLX980eWGztLVb9cRjl 8FyC539GWNRkPUUpkoMcalaS4DBpWNEGyEQ21qMUPhySNpAgyR8aeo9su+nQUrTicoP5 tDmsJSpZVpr5ur72iUigNog2fqOSvng3UxF1mmP9/Fd+fQ+Vr2s6T6gqIfuISM2M9D5s 993z9dhe7t/ZakFzrFvBRlfjeWYvdmGheqLfGcBNBP+TxFiURt0G1WKjK5wOcR7FA6tH iksFoPa19j0T85goUlzXqf3dWIUjkEJGjtiO0PNGsYDh6j8neLkYZiMtim1mdhjPEaJH vjtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=YuyxPvfdSPgPD6KU7NZL6M5QIHYm5hRSke6qFmyrFeA=; b=horfuUB0ANtILyB6L1x4QeWhi+yqCwKmjwW5tUS2ZMFfROS85EB6A+x8S3uzEb1Z+J KGj0wOYorCZUo+xb5iCtMtnhHenlpQHzbdfdTR/zutIplwi1I8pVLvbnZyu7QlUbNFXg ACmD+YcPslaP0Two10vtOVRC7ixJgLOcs2KQ5CeZHZi0WuulVSAVvNRDGD2hL0SkcxaW Ep8YPDbXNaXAlV44Xz3lK/NI2ucxE2IkCfMBracZ0Kt/i4sHX3cr5wHJxa15sv7dm/sN 9EheUnCkKPjuyqM3gL9eG9g2IDhq+SOKyXEbHKG7RgRMvBq+lFxjm0X0I9+grfEwfco5 H9AA== X-Gm-Message-State: AOAM531O9VPojXE5bXA9uK8mEfrzxOmrixtrxD6yaiEewKFExIb4pkeN wcjWsrBlLBKLpbdhQeL5KHmYa7KE X-Google-Smtp-Source: ABdhPJzG5AgFcH517BIrAfc1tBXY5buruc13kaO46hjGRWyn5pmPfgyR1m8RBLqarOPk0TE5dLxTPw== X-Received: by 2002:a17:902:bc89:: with SMTP id bb9mr10927640plb.101.1589694801158; Sat, 16 May 2020 22:53:21 -0700 (PDT) Received: from Kael ([67.230.166.176]) by smtp.gmail.com with ESMTPSA id d7sm5761045pfa.63.2020.05.16.22.53.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2020 22:53:20 -0700 (PDT) Date: Sun, 17 May 2020 13:53:12 +0800 From: Chris Zheng To: bug-gnu-emacs@gnu.org Subject: 28.0.50; calculator.el: Cannot input negative exponents Message-ID: <20200517055312.jtwughazs453lbzt@Kael> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=chriszheng99@gmail.com; helo=mail-pl1-x636.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) Hello, With current master, starting Emacs with `-Q`: 1. M-x calculator 2. Input 1e-3 RET You will get 1 instead of 0.001. I believe this happens since Emacs 26.1. The root cause is the `calculator-string-to-number` function in lisp/calculator.el. Now the function gives (calculator-string-to-number "1e-3") => 1.0 (calculator-string-to-number "1e3") => 1000.0 (calculator-string-to-number "1e") => 1.0 The funcional code is (replace-regexp-in-string "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str) It changes `1e-3` to `1e0-3` that is recognized as 1. I have a possible fix attached below. Please see if it is correct. Thank you, Chris Zheng From 7693d7072e4787c4b0663f490be5d83c1d9a6ee3 Mon Sep 17 00:00:00 2001 From: Chris Zheng Date: Sun, 17 May 2020 13:43:35 +0800 Subject: [PATCH 1/1] Fix calculator exponent input * lisp/calculator.el (calculator-string-to-number): Change the regexp to correctly deal with negative exponents. --- lisp/calculator.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/calculator.el b/lisp/calculator.el index 7e0b2fcc6a..fa3eb19099 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -863,7 +863,7 @@ calculator-string-to-number (let* ((str (replace-regexp-in-string "\\.\\([^0-9].*\\)?$" ".0\\1" str)) (str (replace-regexp-in-string - "[eE][+-]?\\([^0-9].*\\)?$" "e0\\1" str))) + "[eE]\\([+-]?\\)?$" "e\\10" str))) (float (string-to-number str))))) (defun calculator-push-curnum () -- 2.16.1.windows.1 ------------=_1589794142-8840-1-- From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Chris Zheng Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 May 2020 15:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 41347-done@debbugs.gnu.org Received: via spool by 41347-done@debbugs.gnu.org id=D41347.158981408026331 (code D ref 41347); Mon, 18 May 2020 15:02:02 +0000 Received: (at 41347-done) by debbugs.gnu.org; 18 May 2020 15:01:20 +0000 Received: from localhost ([127.0.0.1]:48044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jahGZ-0006qd-Rt for submit@debbugs.gnu.org; Mon, 18 May 2020 11:01:20 -0400 Received: from mail-pj1-f43.google.com ([209.85.216.43]:52623) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jahGY-0006qO-At for 41347-done@debbugs.gnu.org; Mon, 18 May 2020 11:01:18 -0400 Received: by mail-pj1-f43.google.com with SMTP id a5so5355291pjh.2 for <41347-done@debbugs.gnu.org>; Mon, 18 May 2020 08:01:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=ufIbdfaKOsDAycwOCP0vsKAWFIjYJroRCaDqIzjcwr8=; b=nvJTamPvI07hrOFPEQVmogM4Xettu1240QDa3yHT/wTmXPW3U0MAMxP34BSqBz/JxT Vs0IBnEfA13ZqVcMP76XA/1VEU7wPdljuVkxlGPrRYCisD9hm2OI0AHG5EFTJ60+if68 8cfEfUGtqDqKCSX+pIO9/KUcYeiRNlw75O6ooxNXbK3wZ2U62jP5B8g3rrfII4Sl99wb LMi+dCr4otYAj2PAaCnNeMTLh4FE7ABB6X4/pkvw2Vlv+6yX0AwCa755akax5DokgS9M xwoGB9qqyrynP/ykvu2VCePEid6YEkZagz/tM/Dqs/U3myM5qufUqSO8l2fP42NAqLq3 Z0dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ufIbdfaKOsDAycwOCP0vsKAWFIjYJroRCaDqIzjcwr8=; b=nBtZjA55K1hcxwhIZ3r48kObRAJ0vOEqSB/H/hO0Xo9dRaSHz1AvtJ0TnjXStb50Xk gB72K/HfsdNax/LihGGARCpsh5E2EsMEdoG4cjb+tZCK4SGX0miifyFcfv1OHGjH7xMy e2AlLhe5YvU8JZvwiHevIpq7ACetikXtH5VizkbIuuozy/CmDqUcDOJE3l7jYL9bcw10 0GeHegdIImArBUPLSpLy5kVVyqTTAAqgjTegVuRgxQrzGjVTbLvn/AxTuVPF3Q5DPXJ7 kSCVvC7x1U8Pvd0QBIgPx3fUz0R1YwzN8jM748156ZMcMTyeb5+rY3wBa3GYLcO8BpqP yUZw== X-Gm-Message-State: AOAM530yeBrPBbuMwmce/uLZJ4YuMuQB/O43jYE6pX3A5o8968iV+Q8t E3VpeRrYUs5fJIxmilwX1D8= X-Google-Smtp-Source: ABdhPJxILWCA7YLbjgAyFHHhrDMZrH4bQR62F1vQmuISR19cjrQfW92aWJZJBQ6vnDZ7ggMijfFH9g== X-Received: by 2002:a17:90a:b28a:: with SMTP id c10mr1724895pjr.223.1589814072464; Mon, 18 May 2020 08:01:12 -0700 (PDT) Received: from Kael ([67.230.166.176]) by smtp.gmail.com with ESMTPSA id p6sm7923444pgl.26.2020.05.18.08.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 08:01:11 -0700 (PDT) Date: Mon, 18 May 2020 23:01:04 +0800 From: Chris Zheng Message-ID: <20200518150104.bfzfa6jckidqerag@Kael> References: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Mon, May 18, 2020 at 11:28:21AM +0200, Mattias Engdegård wrote: >17 maj 2020 kl. 22.26 skrev Eli Barzilay : > >> the idea is to mimic common calculators >> where you can type "3." or "3e" and get 3. > >Thank you Eli! I can confirm that after removing all the string transformation prior to the call to string-to-number, everything works as expected except "1.e3" (dot before E). A single transformation taking care of that case was added for the sake of completeness. > >The attached patch has now been pushed to master. Hello Mattias, Thank you for fixing it. Still I think it is uncommon to use `rx` here... Best regards, Chris From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 May 2020 15:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chris Zheng Cc: 41347@debbugs.gnu.org Received: via spool by 41347-submit@debbugs.gnu.org id=B41347.158981467827210 (code B ref 41347); Mon, 18 May 2020 15:12:02 +0000 Received: (at 41347) by debbugs.gnu.org; 18 May 2020 15:11:18 +0000 Received: from localhost ([127.0.0.1]:48053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jahQA-00074k-P0 for submit@debbugs.gnu.org; Mon, 18 May 2020 11:11:18 -0400 Received: from mail1459c50.megamailservers.eu ([91.136.14.59]:53296 helo=mail267c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jahQ8-00074W-JC for 41347@debbugs.gnu.org; Mon, 18 May 2020 11:11:13 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1589814666; bh=/13DjKQMk9n2encRrWCD5nD4/HdZPyuXLow0MmvCwrU=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=fn32rneO70cCOEcLncncQohHbt3Z/UkMEYiWue0RlCcdCcXjyHLJNwA9vjaLyNHva EFiEdWDHz06I5veyepZjZ9gJz6iE8Rl+xKmGaT6MiDEvfSUvreUcKmgHsupbvtbXi/ h8VHUtOW4cpiArLm8EiJxugxMDrW4tAHk3kmjb3o= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail267c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 04IFB4TV028765; Mon, 18 May 2020 15:11:05 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: <20200518150104.bfzfa6jckidqerag@Kael> Date: Mon, 18 May 2020 17:11:03 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> <20200518150104.bfzfa6jckidqerag@Kael> X-Mailer: Apple Mail (2.3445.104.14) X-CTCH-RefID: str=0001.0A782F1D.5EC2A532.0089:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Cf92G4jl c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=pGLkceISAAAA:8 a=3twT86Hbt6tM31NeN5sA:9 a=CjuIK1q_8ugA:10 X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 18 maj 2020 kl. 17.01 skrev Chris Zheng : > Thank you for fixing it. Still I think it is uncommon to use `rx` here... Yes, in this case rx doesn't improve the readability much. It doesn't hurt, though, does it? It's just become a habit of mine to use rx everywhere. Try it you too! Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: megamailservers.eu] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 18 maj 2020 kl. 17.01 skrev Chris Zheng : > Thank you for fixing it. Still I think it is uncommon to use `rx` = here... Yes, in this case rx doesn't improve the readability much. It doesn't = hurt, though, does it? It's just become a habit of mine to use rx everywhere. Try it you too! From unknown Sun Jun 22 04:23:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents Resent-From: Eli Barzilay Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 May 2020 19:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41347 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Cc: 41347-done@debbugs.gnu.org, Chris Zheng Received: via spool by 41347-done@debbugs.gnu.org id=D41347.158982957225841 (code D ref 41347); Mon, 18 May 2020 19:20:02 +0000 Received: (at 41347-done) by debbugs.gnu.org; 18 May 2020 19:19:32 +0000 Received: from localhost ([127.0.0.1]:48288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jalIR-0006ij-TJ for submit@debbugs.gnu.org; Mon, 18 May 2020 15:19:32 -0400 Received: from mail-ed1-f44.google.com ([209.85.208.44]:46662) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jalIQ-0006iW-83 for 41347-done@debbugs.gnu.org; Mon, 18 May 2020 15:19:30 -0400 Received: by mail-ed1-f44.google.com with SMTP id l3so9419205edq.13 for <41347-done@debbugs.gnu.org>; Mon, 18 May 2020 12:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=barzilay-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=GRBC9SWxSpXZIe3zzvSTcgzWWi4Sk7qTrIDqOMVA8LQ=; b=RjP3IuNoQhcs2H6+M1JLOr4bXWTIw8wWDz1RADGjHWOxHPyARxJk+iTi/TY2y1qTRN /sl2nrg3UMD1ai8nfogOGpD5z+KHB8NPafQbVKrhCdwJ2mPFqbXu6EPP+8bIVCcom7jv 4jOhYl3yXH/wl9aVBomKOFT1Kp4BeumamUmhAji4ALQwqyhK5XLnnIvjen3EyRtP2CaO fb9M6GfN+PyqhORfM/uye1xBMhA80tyyCRdEjQcNXb3MFpA/5BkCOFw98ZTipcp3wizR lZN/UaVRyNdMOYUuoy2opfauSjd9vq3pmud5IA4675v+3wYvMxiZLQauiVXL/PqDPX0K DLZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GRBC9SWxSpXZIe3zzvSTcgzWWi4Sk7qTrIDqOMVA8LQ=; b=IyMl0sfn5QD1wqJn+Sywb4nLT7jzQpk+PkjwIijaGmIJd03zNKz7Hu6VueVsRKAg+R xTCg+65U3KGJ7plHGeZl8BY/F0+ZQNyPmv135PxupncAbYWi/UJ/YtmfA33ZBj1XmI3f BOI/MUmDBeI8RLmctvX0Oh7kvmpKFJzIXDeN39NXf5NX07NxqK0Z88c9Ndf8Hb6XCOjs t1EjBWV2SZX7sPx1vf/S4LH06oQv6POUMA+ddfXGNRJYKVDlG3xxFTLRFenXKS9HJyKs Ep6btwsuzz8xtXYKCzU8ubhRq6PmM2H6VLv/Fn/NiyFO4WSPnRyZvGCJ8ddn/oNwuPy5 o5Yg== X-Gm-Message-State: AOAM532dy/XEuuNRyRKd3OwOD5JwkO5sz4CSVjLJURhHvTp+ciYwECFi xabxv/FNsLWTwj8ciGGz4OfeoD0iDb6jTAqbNxmmqA== X-Google-Smtp-Source: ABdhPJwBMmkDRTWW0GRlG1s9gEl9DI57GFXNnMr88b97DM2darWjM9p7L6yRgku0bUw6DFeX9aCQwK3dfccXyeSzq3M= X-Received: by 2002:aa7:cac8:: with SMTP id l8mr15315486edt.103.1589829564255; Mon, 18 May 2020 12:19:24 -0700 (PDT) MIME-Version: 1.0 References: <60FECFFF-BF00-4D6A-9297-105B1E1B69C8@acm.org> <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> In-Reply-To: <4D0C7ECD-7179-435A-9783-08F05E8CC204@acm.org> From: Eli Barzilay Date: Mon, 18 May 2020 15:19:11 -0400 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Thanks! -- I'll try to get to testing it soon-ish... On Mon, May 18, 2020 at 5:28 AM Mattias Engdeg=C3=A5rd w= rote: > > 17 maj 2020 kl. 22.26 skrev Eli Barzilay : > > > the idea is to mimic common calculators > > where you can type "3." or "3e" and get 3. > > Thank you Eli! I can confirm that after removing all the string transform= ation prior to the call to string-to-number, everything works as expected e= xcept "1.e3" (dot before E). A single transformation taking care of that ca= se was added for the sake of completeness. > > The attached patch has now been pushed to master. > --=20 ((x=3D>x(x))(x=3D>x(x))) Eli Barzilay: http://barzilay.org/ Maze is Life!