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: Stefan Monnier
Subject: Re: integer overflow handling for most-negative-fixnum
Date: Mon, 23 Jul 2018 15:57:50 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> I can add some form of bitwidth modifiers later if we find use cases that
> can help motivate what to do about the corner cases.

Another option for the "bitwidth case" is to do it outside of `format`.
I.e. instead of

    (format "%/32x" n)

you'd use

    (format "%x" (truncate-to-bitwidth n 32))

where `truncate-to-bitwidth` would turn a negative number into its
positive equivalent (mod 2^bitwidth).  That shouldn't be too hard to
implement in Elisp once we have bignums.


        Stefan




reply via email to

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