bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8611: fixnum arithmetic should not wrap around


From: Paul Eggert
Subject: bug#8611: fixnum arithmetic should not wrap around
Date: Tue, 03 May 2011 21:10:00 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8

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 via email to

[Prev in Thread] Current Thread [Next in Thread]