GNU bug report logs - #64441
29.0.92; elisp arithmetic error at ielm prompt

Previous Next

Package: emacs;

Reported by: Van Ly <van.ly <at> sdf.org>

Date: Mon, 3 Jul 2023 16:26:02 UTC

Severity: normal

Tags: notabug

Found in version 29.0.92

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64441 in the body.
You can then email your comments to 64441 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Mon, 03 Jul 2023 16:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Van Ly <van.ly <at> sdf.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 03 Jul 2023 16:26:02 GMT) Full text and rfc822 format available.

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

From: Van Ly <van.ly <at> sdf.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.92; elisp arithmetic error at ielm prompt
Date: Mon, 3 Jul 2023 16:20:34 GMT
[Message part 1 (text/plain, inline)]
Hello,

The following calculation errors in elisp.

  ELISP> (/ (* (/ 3 4) (/ 7 13)) (/ 5 12))
  *** Eval error ***  Arithmetic error

The SBCL repl doesn't.

  CL-USER> (/ (* (/ 3 4) (/ 7 13)) (/ 5 12))
  63/65 (0.9692308, 1260/13%)

Steps to reproduce the error.

  1. start using, 'emacs -Q'
  2. get to the ielm elisp prompt, 'M-x ielm'
  3. enter the above calculation

[bug-gnu-emacs-report.text (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Mon, 03 Jul 2023 16:52:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Van Ly <van.ly <at> sdf.org>, 64441 <at> debbugs.gnu.org
Subject: Re: bug#64441: 29.0.92; elisp arithmetic error at ielm prompt
Date: Mon, 03 Jul 2023 18:50:58 +0200
On Mon, 3 Jul 2023 16:20:34 GMT Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org> wrote:

> Hello,
>
> The following calculation errors in elisp.
>
>   ELISP> (/ (* (/ 3 4) (/ 7 13)) (/ 5 12))
>   *** Eval error ***  Arithmetic error
>
> The SBCL repl doesn't.
>
>   CL-USER> (/ (* (/ 3 4) (/ 7 13)) (/ 5 12))
>   63/65 (0.9692308, 1260/13%)
>
> Steps to reproduce the error.
>
>   1. start using, 'emacs -Q'
>   2. get to the ielm elisp prompt, 'M-x ielm'
>   3. enter the above calculation

`/' in Elisp is different from `/' in Common Lisp.

(elisp) Arithmetic Operations:

  If all the arguments are integers, the result is an integer,
  obtained by rounding the quotient towards zero after each division.

Hence (/ 3 4), (/ 7 13) and (/ 5 12) all evaluate to 0, and "If you
divide an integer by the integer 0, Emacs signals an ‘arith-error’
error".

But in Common Lisp
(http://www.lispworks.com/documentation/HyperSpec/Body/f_sl.htm):

  If each argument is either an integer or a ratio, and the result is
  not an integer, then it is a ratio.

Hence (/ 3 4) => 3/4,  (/ 7 13) => 7/13 and (/ 5 12) => 5/12

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Mon, 03 Jul 2023 16:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Mon, 03 Jul 2023 16:54:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Van Ly <van.ly <at> sdf.org>
Cc: 64441 <at> debbugs.gnu.org
Subject: Re: bug#64441: 29.0.92; elisp arithmetic error at ielm prompt
Date: Mon, 03 Jul 2023 19:53:54 +0300
> Date: Mon, 3 Jul 2023 16:20:34 GMT
> From:  Van Ly via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> The following calculation errors in elisp.
> 
>   ELISP> (/ (* (/ 3 4) (/ 7 13)) (/ 5 12))
>   *** Eval error ***  Arithmetic error

You are dividing zero by zero.

This is not a bug.

> The SBCL repl doesn't.

Emacs is not SBCL.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Tue, 04 Jul 2023 10:45:02 GMT) Full text and rfc822 format available.

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

From: Van Ly <van.ly <at> sdf.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: bug-gnu-emacs <at> gnu.org, 64441 <at> debbugs.gnu.org
Subject: Re: bug#64441: 29.0.92; elisp arithmetic error at ielm prompt
Date: Tue, 4 Jul 2023 10:44:06 GMT
> From: Stephen Berman
>
> `/' in Elisp is different from `/' in Common Lisp.
> 
> (elisp) Arithmetic Operations:
> 
>   If all the arguments are integers, the result is an integer,
>   obtained by rounding the quotient towards zero after each division.
> 
> Hence (/ 3 4), (/ 7 13) and (/ 5 12) all evaluate to 0, and "If you
> divide an integer by the integer 0, Emacs signals an ‘arith-error’
> error".
> 
> But in Common Lisp
> (http://www.lispworks.com/documentation/HyperSpec/Body/f_sl.htm):
> 
>   If each argument is either an integer or a ratio, and the result is
>   not an integer, then it is a ratio.
> 
> Hence (/ 3 4) => 3/4,  (/ 7 13) => 7/13 and (/ 5 12) => 5/12
> 

Thank you Steve.










Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Tue, 04 Jul 2023 10:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64441; Package emacs. (Fri, 08 Sep 2023 16:22:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Van Ly <van.ly <at> sdf.org>
Cc: 64441 <at> debbugs.gnu.org
Subject: Re: bug#64441: 29.0.92; elisp arithmetic error at ielm prompt
Date: Fri, 8 Sep 2023 09:20:56 -0700
tags 64441 + notabug
close 64441
thanks

Eli Zaretskii <eliz <at> gnu.org> writes:

>>   ELISP> (/ (* (/ 3 4) (/ 7 13)) (/ 5 12))
>>   *** Eval error ***  Arithmetic error
>
> You are dividing zero by zero.
>
> This is not a bug.

Yup, so I'm closing it.




Added tag(s) notabug. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 08 Sep 2023 16:22:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 64441 <at> debbugs.gnu.org and Van Ly <van.ly <at> sdf.org> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 08 Sep 2023 16:22:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 07 Oct 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 216 days ago.

Previous Next


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