I'm searching for a fast way to find out if a number stored in a float is near to an integer. Basically something like this:
bool IsNear = (fabs(float_number - (int)float_number) <= some_small_value)
I don't really care about the rounding mode, the exact value of some_small_value ect. Only a heuristic is needed. I wouldn't even mind a code that gives false negatives at times. No handling for NAN's and denormals required as well.
To the background: The system I'm working on is quite slow when it comes to FPU stuff. It's not soft-float but close from a performance point of view. To translate it from my system to the x86 world, imagine an FPU operation would be 5 to 10 times slower than the integer counterpart. Rounding and transfering data from and to the FPU are even slower.
So - how do I find out fast if a float is roughly representable as an integer. I need this to accelerate a function which can be done a lot quicker with whole numbers (a special case occures quite often).
Any ideas? Where are the IEEE 754 wizards?