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: Paul Eggert
Subject: Re: integer overflow handling for most-negative-fixnum
Date: Mon, 23 Jul 2018 12:40:36 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Helmut Eller wrote:

Can't you simply use some other character for this, like %z (or %ℤ) and
leave %x alone.

It'd require three new letters, since %o is also affected. I'd rather not chew up so many letters for such an obscure feature. And as it doesn't appear that this change will break much if anything, I'd rather not chew up any letters at all; let's just fix %x etc. so that they're not machine-dependent.

However, it would
be an incompatible change, so let's have the behavior depend on a
compatibility variable, much as we already do for
read-integer-overflow-as-float.

This sounds more like that other desaster: text-quoting-style.

:-) Yes, I remember that well. However, this is a much smaller deal. With text-quoting style I had to change many uses and the magnitude of the task was known (most of it was in the patches I proposed). Here, I've audited the Emacs source code and have not found any need to change anything, except optionally for appearance to make a few strings look nicer, and in a couple of tests that stress Emacs with unlikely inputs, tests that I've updated in the patch I proposed. See Bug#32252.

%a also seems like a candidate: in C99 %a prints floating point numbers
in hexadecimal notation.
If we were to implement %a it should be reasonably consistent with C99 %a, and this is something quite different from %x and %X and %o. So we should use a different letter, if we're going to use any new letter which I'd rather not.

That might be useful so that Emacs can write/read floats without rounding 
errors.

We already have that: (format "%s" N) outputs any number N in a format that can be read back without rounding errors. Similar functionality is available via (number-to-string N), (prin1-to-string N), etc. With all these, the only loss of floating-point info is with NaNs, something I'd like to fix even though they're not numbers.



reply via email to

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