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 10:02:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Tomas Nordin wrote:

> Why not just use good old %f?
>
> (format "%.0f%%" (* 0.127 100)) ;; -> "13%"

Congrats, it works: 

;; (format "%.0f%%" (* 0.01 100)) ; "1%"
;; (format "%.0f%%" (* 0.1  100)) ; "10%"
;; (format "%.0f%%" (* 1    100)) ; "100%"
;; (format "%.0f%%" (* 2    100)) ; "200%"

> Or respecting SI recommendations:
>
> (format "%.0f %%" (* 0.127 100)) ;; -> "13 %"

Maybe if DIN recommended the same thing...

-- 
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]