|
From: | Drew Adams |
Subject: | RE: bike shifting - output decimal in percent |
Date: | Sat, 18 May 2019 20:50:05 -0700 (PDT) |
> How do I output a decimal float digit > 0 <= 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'. E.g. (setq foo 0.314159265358979) (format "%2.14g%%" (* 100.0 foo)) => "31.459265358979%" (format "%2.2g%%" (* 100.0 foo)) => "31%"
[Prev in Thread] | Current Thread | [Next in Thread] |