GNU bug report logs - #41347
28.0.50; calculator.el: Cannot input negative exponents

Previous Next

Package: emacs;

Reported by: Chris Zheng <chriszheng99 <at> gmail.com>

Date: Sun, 17 May 2020 05:54:02 UTC

Severity: normal

Found in version 28.0.50

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 41347 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 41347 <at> debbugs.gnu.org, Chris Zheng <chriszheng99 <at> gmail.com>,
 Eli Barzilay <eli <at> barzilay.org>
Subject: Re: bug#41347: 28.0.50; calculator.el: Cannot input negative exponents
Date: Sun, 17 May 2020 13:57:50 +0200
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 <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




This bug report was last modified 5 years and 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.