* A more sophisticated (format "%f" ...)?
@ 2015-06-14 19:10 Marcin Borkowski
0 siblings, 0 replies; 2+ messages in thread
From: Marcin Borkowski @ 2015-06-14 19:10 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
Hi all,
I need to format a float so that I get /at most/ 2 decimal digits after
point /and/ at most 5 characters altogether. For instance,
2 -> 2
2.34567 -> 2.35
123.456 -> 123.5
123456 -> XXXXX (since this is too long to fit in 5 characters;
alternatively, I can more or less safely assume that it's less than 1000)
Is there anything like that in Elisp (or some library), or do I have to
write it myself?
TIA,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: A more sophisticated (format "%f" ...)?
[not found] <mailman.5001.1434309027.904.help-gnu-emacs@gnu.org>
@ 2015-06-14 21:39 ` Pascal J. Bourguignon
0 siblings, 0 replies; 2+ messages in thread
From: Pascal J. Bourguignon @ 2015-06-14 21:39 UTC (permalink / raw)
To: help-gnu-emacs
Marcin Borkowski <mbork@mbork.pl> writes:
> Hi all,
>
> I need to format a float so that I get /at most/ 2 decimal digits after
> point /and/ at most 5 characters altogether. For instance,
>
> 2 -> 2
> 2.34567 -> 2.35
> 123.456 -> 123.5
> 123456 -> XXXXX (since this is too long to fit in 5 characters;
> alternatively, I can more or less safely assume that it's less than 1000)
>
> Is there anything like that in Elisp (or some library), or do I have to
> write it myself?
The later.
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-14 21:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-14 19:10 A more sophisticated (format "%f" ...)? Marcin Borkowski
[not found] <mailman.5001.1434309027.904.help-gnu-emacs@gnu.org>
2015-06-14 21:39 ` Pascal J. Bourguignon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).