I am testing ceil vs floor and somehow calling floor 67108864 times results in zero ticks. I know that isn't right, any help/understanding is appreciated.
Here is the output.
ceil test
1297 Clock ticks
1.2970 Seconds
Loops 67108864
floor test
0 Clock ticks
0.0000 Seconds
Loops 67108864
Look for some compiler optimization that allows compiler to reorder instructions. Then disable that one. ;-)
And you should use double with floor() or else you are not only testing floor, but also your friendly compiler's float->double->float conversion speed.
And you should use double with floor() or else you are not only testing floor, but also your friendly compiler's float->double->float conversion speed.
Waitasecond.. that was wrong. floor has a float version too.. Confused it with sin() and sinf ("floorf" would sound somehow.. offending. ;-)
I couldn't find any optimization remotely close to reorder instructions (using vs2008).
This is what is on:
Optimization: Maximize speed (/O2)
Enable Intrinsic Functions: Yes (/Oi)
Whole Program Optimization: Enable link-time code generation (/GL)