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: Helmut Eller
Subject: Re: integer overflow handling for most-negative-fixnum
Date: Sat, 21 Jul 2018 22:10:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Sat, Jul 21 2018, Paul Eggert wrote:

> How about this idea. First, we extend 'format' to support bitwidth
> modifiers for twos-complement representation. For example, (format
> "%/24x" -1) would format just the low-order 24 bits of the integer,
> and would return "ffffff" regardless of machine word size or whether
> bignums are used.

That sounds reasonable.

> Second, we change (format "%x" -1) to return "-1" rather than a
> machine-dependent string like "3fffffffffffffff" as it does now. That
> would make Elisp be more machine-independent, would solve Andy's
> problem, and would solve other problems once we have bignums, and in
> hindsight it's what we should have done originally.

Can't you simply use some other character for this, like %z (or %ℤ) and
leave %x alone.  BTW, %i also seems to be a valid format specifier but
where is it documented?

> 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.

Helmut




reply via email to

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