Subject: Re: bug#32463: 27.0.50; (logior -1) => 4611686018427387903

From: Andy Moreton <[email-masked]>
Date: Sun, 19 Aug 2018 19:00:43 +0100

On Sun 19 Aug 2018, Paul Eggert wrote:

>>> a) A bug in bignumcompare for 64bit Windows. Patch is here:
>>> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00487.html
>>> ...
>>> b) fmod_float has a bug:
>>> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00442.html
>>>
>>> c) Extend Fexpt to support bignums. Patch is here:
>>> http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00503.html
>>>
>>> d) Extend Fceiling, Ffloor, Fround and Ftruncate to support bignums by
>>>    updating rounding_driver.
>
> I worked on these and installed patches to master that should do (a), (b), and
> (c). For (d) I wrote the attached patch, and plan to test it a bit more before
> installing, as it's the hairiest.

Thanks for fixing up all of these issues. Hopefully with some added test
cases the patch for (d) will also work too. Two more issues:

e) Grepping for FIXED_OR_FLOATP shows various places where code either
   assumes that all types are covered (no longer true now there are
   bignums), or uses incorrect accessors for the value in the object.
   For example, Fdefine_coding_system_internal has:

      else if (FIXED_OR_FLOATP (tmp))
        {
          dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFIXNAT (tmp)));

   Which should probably be:

      else if (NUMBERP (tmp))
        {
          dim2 = CHARSET_DIMENSION (CHARSET_FROM_ID (XFLOATINT (tmp)));

f) Users of CONS_TO_INTEGER and INTEGER_TO_CONS could be converted to
   use bignums.