bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Paul Eggert
Subject: bug#30408: 24.5; (format "%x" large-number) produces incorrect results
Date: Sat, 17 Feb 2018 17:08:22 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

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".

Attachment: 0001-Avoid-losing-info-when-converting-integers.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]