std.format request
Saaa
empty at needmail.com
Tue Jul 28 13:41:34 PDT 2009
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);
assert(f==f2);
The formatting I'm trying to get can be seen here (decimal):
http://www.h-schmidt.net/FloatApplet/IEEE754.html
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!
More information about the Digitalmars-d
mailing list