<$BlogRSDURL$>
Ankh Morpork's Finest Coder
Monday, January 24, 2005

Answer to The Random Infinity
As a followup to the previous question on why the code fails, here is another program that will prove why it fails. Without running it, can you guess what line it will fail on?

double d = 0.0000000001d;
Console.WriteLine(d);
Decimal dd = Decimal.Parse(d.ToString());
Console.WriteLine(dd);


Answer - The Parse method will fail for any double with precision of more that 4 decimal places.

0 Comments:

Post a Comment