Why does this simple Console App Output 100000000000000
instead of 99999999999999.99
or atleast 99999999999999.984
as the debugger is showing?
static void Main(string[] args)
{
double bigNum = 99999999999999.99;
Console.WriteLine(bigNum); //Console.WriteLine will internally ToString, but you can add what ever ToString() you want here the result will always be undesired
}
Console Output:
Debug Output:
For clarification:
Yes, I know of the value type decimal
and its superiour precision over double
, but I never heard of that ToString()
of double
could give wrong results.