GNU bug report logs -
#30408
24.5; (format "%x" large-number) produces incorrect results
Previous Next
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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I wrote this originally on
https://emacs.stackexchange.com/questions/38710/why-does-format-x-some-large-number-produces-incorrect-results
and a poster recommended I mention this here.
I wanted the hexadecimal string for a large integer such as below:
(format "%x" 2738188573457603759)
This returns 2600000000f95c00 which is incorrect, it should be
2600000000f95caf.
The value of most-positive-fixnum on my box is 0x1fffffffffffffff which is
less than the number I'm supplying above.
As a user I'm a bit baffled what is happening. The manual indicates
integers larger than this range are converted to a floating-point number
which is a concern for precision but I suspect this is what is biting me
here?
I should have known there was an issue with this number since normally I
evaluate them directly using eval-last-sexp and it didn't show the
octal/hex variants.. :)
I wonder why Emacs Lisp doesn't support bignums by default, so precision
would not be an issue?
[Message part 2 (text/html, inline)]
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.