www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.format request

reply "Saaa" <empty needmail.com> writes:
Could an option be added to the formatting to elide trailing zero's for %f ?
That way it is possible to create an more optimal formatting for which the 
following holds:

float f;
s = format(f);
float f2 = to!(float)(s);

The formatting I'm trying to get can be seen here (decimal):
try 0.1, 0.0001, 10 & 10000000

%g fails to format like this because it uses %f for as small as 10^-5,
thus loosing precision for floats with leading zero's, like 0.0001234567

It would be even nicer to have this kind of formatting added to std.format! 
Jul 28 2009
parent "Saaa" <empty needmail.com> writes:
I don't see how all this property talk has anything to do with formatting!
Jul 29 2009