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

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

bug#32252: [PATCH] %o and %x now format signed numbers


From: Paul Eggert
Subject: bug#32252: [PATCH] %o and %x now format signed numbers
Date: Mon, 23 Jul 2018 16:30:34 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 07/23/2018 12:49 PM, Drew Adams wrote:
1. I don't see where the doc now mentions variable `binary-as-signed'.

binary-as-signed is intentionally documented only in its doc string. The intent is that it be like the variable read-integer-overflow-as-float. That is, although it's present if someone actually needs it, we're hoping actual use cases are so rare that we can obsolete the variable soon. This is also why it's not a user option.

I don't see where the doc mentions what the output is for %o and %x - for a 
negative number or a positive number.

For %o the Elisp manual says "Replace the specification with the base-eight representation of an integer", and there is similar wording for %x and %X. It might be helpful to nail down negative-integer handling with wording like "Format a negative integer with a leading @samp{-} followed by the absolute value."

3. Why the change in the default behavior?

The primary motivation is that the old behavior can't reasonably be extended to bignums. Also, it's long been an annoyance that the old behavior was machine dependent: (format "%x" -1) yields different answers depending on what machine you're running on. The proposed change would make this usage portable, and would make it obvious what bignums should do.






reply via email to

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