[Top][All Lists]

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

bug#25557: Documentation of format doesn't describe "g" accurately

From: Clément Pit--Claudel
Subject: bug#25557: Documentation of format doesn't describe "g" accurately
Date: Sat, 28 Jan 2017 10:04:33 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 2017-01-28 03:37, Eli Zaretskii wrote:
>> …
> Fixed.
>> …
> I don't understand what you are trying to say (nor the significance of
> the '.'  flag in the example).  '#' forces %g to leave the trailing
> zeros after the decimal, so I added that -- is that what you wanted to
> say?
>> …
> Fixed.
>> Similar problems seem to exist in the actual documentation.
> If you mean the ELisp manual, I fixed that as well.

Thanks a lot! My comment about '#' was that the description of '#' suggested 
that it would only change things when the precision is 0 (which wasn't true).

>> On a related note, is there a way to get a shortest representation of a 
>> number? Something like %g, but without exponents.
> Sorry, I don't understand the question.  How can you represent an
> arbitrary number without exponents at all, except by %f?

I'd like something like this (with a hypothetical %q):

  (format "%.3q" 3) ⇒ "3"
  (format "%.3q" 3.00) ⇒ "3"
  (format "%.3q" 3.30) ⇒ "3.3"
  (format "%.3q" 3.05) ⇒ "3.05"
  (format "%.3q" 3.352) ⇒ "3.35"
  (format "%.3q" 3100000) ⇒ "3100000"

This is in fact just the same as 'g', except for the last entry (%g produces 
"3.1e+06"). Is this achievable?


Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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