emacs-devel
[Top][All Lists]
Advanced

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

Re: integer overflow handling for most-negative-fixnum


From: Andy Moreton
Subject: Re: integer overflow handling for most-negative-fixnum
Date: Sat, 21 Jul 2018 14:06:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

On Sat 21 Jul 2018, Eli Zaretskii wrote:

>> From: Andy Moreton <address@hidden>
>> Date: Sat, 21 Jul 2018 10:47:25 +0100
>> 
>> ELISP> most-negative-fixnum
>> -2305843009213693952 (#o200000000000000000000, #x2000000000000000)
>> ELISP> #x2000000000000000
>> *** Read error *** Arithmetic overflow error: "2000000000000000 (base 16) is
>> out of fixnum range; maybe set ‘read-integer-overflow-as-float’?"
>> ELISP> #x-2000000000000000
>> -2305843009213693952 (#o200000000000000000000, #x2000000000000000)
>> 
>> If the reader will not accept #x2000000000000000 as input then the value
>> of most-negative-fixnum as a non base10 number octal should have
>> negative sign to ensure consistent handling.
>
> Please don't forget the important use case of showing the hex
> representation of a negative number.  There are situations where I'd
> like to have "M-: -10 RET" display #x3ffffffffffffff6 rather than
> #x-0a.

That use case is how I stumbled upon this in the first place :-)

I also much prefer seeing hex without a sign i.e. showing the
underlying represention, not the value.

> So I'd prefer we fixed the reader, if that's possible without breaking
> something important.

I agree, and I hope that is possible.

    AndyM




reply via email to

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