P
prakashdehury
can some one pls suggest me why?
StreamWriter sw = new StreamWriter(@"c:\Temp\1.txt");
double dd1;
double dd2;
double dd3;
double dd4;
dd1 = 1452.123456789876123456;
dd2 = 1452.123456789123123456;
dd3 = 1452.123456789567123456;
dd4 = 1452.123456789456123456;
sw.WriteLine(dd1.ToString());
sw.WriteLine(dd2.ToString("G"));
sw.WriteLine(dd3);
sw.WriteLine(dd4);
sw.Close();
Output
----------
1452.12345678988
1452.12345678912
1452.12345678957
1452.12345678946
why it round off the values to 11 decimal places?
Thanks
Prakash
StreamWriter sw = new StreamWriter(@"c:\Temp\1.txt");
double dd1;
double dd2;
double dd3;
double dd4;
dd1 = 1452.123456789876123456;
dd2 = 1452.123456789123123456;
dd3 = 1452.123456789567123456;
dd4 = 1452.123456789456123456;
sw.WriteLine(dd1.ToString());
sw.WriteLine(dd2.ToString("G"));
sw.WriteLine(dd3);
sw.WriteLine(dd4);
sw.Close();
Output
----------
1452.12345678988
1452.12345678912
1452.12345678957
1452.12345678946
why it round off the values to 11 decimal places?
Thanks
Prakash