R
Rod Brick
I'm trying to print a Double in straight decimal form, not exponential. I can't seem to accomplish this. This seems like it should
be simple enough. The output I'm looking for is "0.00001", not "1E-05".
I'm obviously baffled by the NumberFormatInfo class, I can't seem to make it do what I want. And, I've tried the following, all of
which have failed to modify the original exponential form. The commented out "D7" statement throws a FormatException. Output is as
follows:
default=1E-05
G7=1E-05
N7=1E-05
F7=1E-05
Here's the code snippet:
double f = 0.00001D;
Console.WriteLine("default=" + f.ToString());
Console.WriteLine("G7="+Double.Parse(f.ToString("G7")));
Console.WriteLine("N7="+Double.Parse(f.ToString("N7")));
Console.WriteLine("F7="+Double.Parse(f.ToString("F7")));
//Console.WriteLine("D7="+Double.Parse(((double)f).ToString("D7")));
be simple enough. The output I'm looking for is "0.00001", not "1E-05".
I'm obviously baffled by the NumberFormatInfo class, I can't seem to make it do what I want. And, I've tried the following, all of
which have failed to modify the original exponential form. The commented out "D7" statement throws a FormatException. Output is as
follows:
default=1E-05
G7=1E-05
N7=1E-05
F7=1E-05
Here's the code snippet:
double f = 0.00001D;
Console.WriteLine("default=" + f.ToString());
Console.WriteLine("G7="+Double.Parse(f.ToString("G7")));
Console.WriteLine("N7="+Double.Parse(f.ToString("N7")));
Console.WriteLine("F7="+Double.Parse(f.ToString("F7")));
//Console.WriteLine("D7="+Double.Parse(((double)f).ToString("D7")));