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, so precision would not be an issue?
0x1fffffffffffffff
is less than0x2600000000f95caf
, which would explain why you're getting these problems. – DoMiNeLa10 Feb 9 '18 at 7:55emacs-devel@gnu.org
. The place to request it is either on that same list or viaM-x report-emacs-bug
(that's for enhancements too, not just bug reports). – Drew Feb 9 '18 at 16:27