Re: decimal floating formatting question
Re: decimal floating formatting question
- Subject: Re: decimal floating formatting question
- From: Jonathan Jackel <email@hidden>
- Date: Fri, 24 Dec 2004 11:51:07 -0500
Try %g. According to man printf, "The argument is printed in style f
or in style e (E) whichever gives full precision in minimum space."
It's not exactly what you want, but close. JJ.
On Dec 22, 2004, at 6:59 PM, Mark Dawson wrote:
Is there a way to format a decimal number with no trailing zeros and
show only "X" number of digits? I would like 1.0 to show up as "1",
1.2 as '1.2";, 1.31457 as "1.3146".
I'm familiar with the "%.4f" type format, but while this limits the
output to 4 decimal points, it adds trailing zeros (i.e., "1.2000").
Is there a way to the best of both worlds via a formatting option?
Thanks!
mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden