I found a bug in c++. I tested it with some compilers, and they all gave me the wrong. Basically we have two variables: a and b. a equals to 2.85f and b equals to 0.85f. If we do a - b we'll end up with two. If we do floorf(a), it also equals to two. That means they both equal. But if we compare their equality, somehow that gives us false. If we test it with different numbers (a = 2.84f, b = 0.84f etc.) it gives us the right answer which is true. I tested the code with TDM-GCC 4.9.2, TDM-GCC 5.1.0 and Visual Studio 2017. Here is the code:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float a = 2.85f;
float b = 0.85f;
cout << "a: " << a << endl
<< "b: " << b << endl
<< "floorf(a): " << floorf(a) << endl
<< "a - b: " << a - b << endl
<< "floorf(a) == (a - b): " << (floorf(a) == (a - b) ? "True" : "False");
return 0;
}