[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64441: 29.0.92; elisp arithmetic error at ielm prompt
From: |
Van Ly |
Subject: |
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.