Float to Int conversions by Greg Young
Greg Young pinged me via IM to show me a problem he's run into - a bug in the C# compiler. Open up Visual Studio and start a C# console app. Paste the following code into the Main routine:
float low = 7f;
float high = 100f;
low = ((high + low) / 2f);
low = ((high + low) / 2f);
low = ((int)(low * 100f)) / 100f;
low = ((high + low) / 2f);
low = ((int)(low * 100f)) / 100f;
low = ((high + low) / 2f);
low = ((int)(low * 100f)) / 100f;
low = ((high + low) / 2f);
low = ((int)(low * 100f)) / 100f;
Console.WriteLine(low);
Console.ReadLine();
Press F5 to run with the debugger. Get a result. Press CTRL+F5 to run without the debugger. Get a different result.
Here is Greg's writeup of the problem.
Greg's already submitted this to Microsoft.