GNU bug report logs - #30408
24.5; (format "%x" large-number) produces incorrect results

Previous Next

Package: emacs;

Reported by: David Sitsky <david.sitsky <at> gmail.com>

Date: Sat, 10 Feb 2018 07:03:02 UTC

Severity: wishlist

Found in version 24.5

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 30408 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Drew Adams <drew.adams <at> oracle.com>, David Sitsky <david.sitsky <at> gmail.com>
Cc: 30408 <at> debbugs.gnu.org
Subject: Re: bug#30408: 24.5; (format "%x" large-number) produces incorrect
 results
Date: Sat, 17 Feb 2018 17:08:22 -0800
[Message part 1 (text/plain, inline)]
This kind of bug has bitten me before, so I think it's worthwhile for Emacs to 
defend against it better. Proposed patch attached. Although this patch doesn't 
address the major problem here (which is that Emacs lacks bignums), it does 
cause Emacs to respond better to large numbers, by not losing information when 
it is reading or printing integers.

With this patch, one cannot evaluate (format "%x" 2738188573457603759) because 
the Lisp reader signals an error when it sees the unrepresentable integer 
2738188573457603759, instead of silently substituting a different number. 
Another example: (format "%d" 18446744073709551616) now returns 
"18446744073709551616" instead of the quite-wrong "9223372036854775807".
[0001-Avoid-losing-info-when-converting-integers.patch (text/x-patch, attachment)]

This bug report was last modified 7 years and 77 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.