Don't compare floats
Floating-point numbers are tricky; one of the first things a programmer needs to remember when working with them is to never check floats for equality. (I believe ReSharper warns you if you do that; I don't know if plain Visual Studio does because I never use it without ReSharper.) If precise representations of decimal numbers is needed, like when manipulating currencies, use decimals instead (if using C#); if a similar primitive type does not exist in your language, write a separate package / module / library to "fake it" by using integer values and scale them down by two or four digits, depending on your needs. (For example, the number 123456 can represent either 1,234.56 or 12.3456 , depending on your application.) Here's a simple code example to show the difference between float s and decimal s in C#: float f1 = 0.1f; float f2 = f1 * 10.0f; float f3 = 0.0f; for (var i = 1; i <= 10; i++) f3 += f1; Console.WriteLine(f2); Console.WriteLine(f3); Consol...