unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30408: 24.5; (format "%x" large-number) produces incorrect results
@ 2018-02-10  6:22 David Sitsky
  2018-02-12  2:49 ` Paul Eggert
  2018-05-06  6:29 ` bug#30408: More context in `read-integer-overflow-as-float'? Bastien
  0 siblings, 2 replies; 5+ messages in thread
From: David Sitsky @ 2018-02-10  6:22 UTC (permalink / raw)
  To: 30408

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

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?

[-- Attachment #2: Type: text/html, Size: 1193 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-06  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-10  6:22 bug#30408: 24.5; (format "%x" large-number) produces incorrect results David Sitsky
2018-02-12  2:49 ` Paul Eggert
2018-02-12  4:56   ` Drew Adams
2018-02-18  1:08     ` Paul Eggert
2018-05-06  6:29 ` bug#30408: More context in `read-integer-overflow-as-float'? Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).