How do I compare an integer and a floating-point value the right way™?
The builtin comparsion operators give incorrect results in some edge cases, for examp
Use double, not float. Take the double value + 0.5. Truncate it by static cast to long long. Now compare the two long longs.