unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 8611@debbugs.gnu.org
Subject: bug#8611: fixnum arithmetic should not wrap around
Date: Tue, 03 May 2011 21:10:00 -0700	[thread overview]
Message-ID: <4DC0D198.7020506@cs.ucla.edu> (raw)
In-Reply-To: <jwvsjsvw953.fsf-monnier+emacs@gnu.org>

On 05/03/11 18:29, Stefan Monnier wrote:
>> Would it be better to change Emacs to use bignums if available?

> ... Other than Calc (and only if someone goes thorugh the trouble to
> port it to the new bignum primitives), I can't think of too many
> packages that would benefit,

I can.  The calendrical and time zone stuff would benefit.

That's the only elisp code that I've had much to do with, but
a quick scan of the Elisp source code suggests several other
modules would benefit as well: arc-mode.el, byte-opt.el, Gnus,
imenu.el, imap.el, lazy-lock.el, and there's more but I got
tired of looking.

> I guess "from outside of Elisp" is a better description than "from some
> C function".  The Lisp reader brings values from outside Elisp
> into Elisp.

I'm still not understanding the principle.  For example,
(string-to-number "536870912") operates entirely within Elisp,
but it returns a float when the integer is out of range.

Perhaps the principle is supposed to be "arithmetic operations
involving only integers always return integers"?  But that's
not right either, since (expt 2 -1) returns 0.5.

In contrast, the principle "operations that would return
an integer out of range, return a nearby float instead"
is simple and easy to explain.





  reply	other threads:[~2011-05-04  4:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-03 18:27 bug#8611: fixnum arithmetic should not wrap around Paul Eggert
2011-05-04  0:31 ` Stefan Monnier
2011-05-04  1:19   ` Paul Eggert
2011-05-04  1:29     ` Stefan Monnier
2011-05-04  4:10       ` Paul Eggert [this message]
2011-05-04 12:57         ` Stefan Monnier
2011-05-04 15:06           ` Paul Eggert
2011-05-04 18:41             ` Stefan Monnier
2016-06-11  0:00 ` Noam Postavsky
2018-08-22 17:02 ` bug#8611: close Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DC0D198.7020506@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=8611@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).