[Top][All Lists]

[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 18:19:26 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110223 Thunderbird/3.1.8

On 05/03/11 17:31, Stefan Monnier wrote:
> Using floats has only been introduced in order to handle things like
> file sizes larger than 4GB, i.e. the int-to-float conversion currently
> only ever happens for values that come from some C function.

Sorry, I don't follow.  The Lisp reader currently sees "536870912"
and generates a float.  How is that "some C function"?
The Lisp reader's behavior has nothing to do with the stat function
or with file sizes or with anything other than how Emacs itself
is implemented.

I'm just trying to understand the general design principle here.

On further thought:

Would it be better to change Emacs to use bignums if available?
I could do that, using GMP, I suppose.  But surely it should return
bignums consistently everywhere: the Lisp reader, string-to-number,
arithmetic operations, etc.

If bignums aren't feasible for some reason, and floats are our best
approximation, shouldn't floats be used consistently whereever
bignums would otherwise be used?

reply via email to

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