W
Wernfried Schwenkner
I've found the discussion about Math.Log and the error with
Math.Log(8,2)
on Google. Unfortunatly the full thread isn't on my news server, so I
can't reply.
The problem doesn't only depend on representation of floating numbers.
When You execute
int res = (int)Math.Log(8, 2);
if (res == 3)
{
Console.WriteLine("right");
}
else
{
Console.WriteLine("false");
}
You get the output "false". My first thoughts also where to the floating
representation. But if You debug the same lines of Code, the debugger
steps to the output of "right", the result res is "3".
Does the debugger use another Math-engine?
Math.Log(8,2)
on Google. Unfortunatly the full thread isn't on my news server, so I
can't reply.
The problem doesn't only depend on representation of floating numbers.
When You execute
int res = (int)Math.Log(8, 2);
if (res == 3)
{
Console.WriteLine("right");
}
else
{
Console.WriteLine("false");
}
You get the output "false". My first thoughts also where to the floating
representation. But if You debug the same lines of Code, the debugger
steps to the output of "right", the result res is "3".
Does the debugger use another Math-engine?