[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8611: fixnum arithmetic should not wrap around
From: |
Stefan Monnier |
Subject: |
bug#8611: fixnum arithmetic should not wrap around |
Date: |
Wed, 04 May 2011 09:57:10 -0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> 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.
No: the content of a string is "external data", so string-to-number,
just like `read', brings external data into the Elisp world.
> In contrast, the principle "operations that would return
> an integer out of range, return a nearby float instead"
> is simple and easy to explain.
Conversion to float is in general not a good idea, as I'm sure you're
aware, since the semantics of floating point numbers is very different
from the semantics of integers. So I'd rather not do it more than we
currently do.
Also, I'd rather not fix something that's not broken, and AFAIK the
current inconsistent behavior has not caused any real problem.
Stefan