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

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

Re: bike shifting - output decimal in percent


From: Emanuel Berg
Subject: Re: bike shifting - output decimal in percent
Date: Sun, 19 May 2019 09:05:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Drew Adams wrote:

>> How do I output a decimal float digit0 <=
>> x <= 1 into percent? ("A percentage?"
>> Correct English?) [...]
>> 
>> But I wonder if/why-not there is/isn't
>> a built-in way to do it?
>
> Use function `format'. See `C-h f format' and
> (elisp) `Formatting Strings'.

You mean

    (info "(elisp) Formatting Strings")

?

> (format "%2.2g%%" (* 100.0 foo)) => "31%"

Great, thanks a lot :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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