Log in

View Full Version : Results from timing floating point operations


owenhealy
02-02-2008, 23:00
I got these results by performing the operations on the fast loop increasing numberse of times and counting the number of fast loops per slow loop, then doing a linear regression. I have nothing to compare this method with to judge its accuracy, and I'd be interested if anyone else has different data.

Operation Time (in slow loops)

blank 2.33e-10
+ 8.71e-04
- 9.60e-04
* 8.35e-04
/ 3.92e-03
fabs 2.75e-04
ldexp 2.34e-03
exp 2.50e-02
sqrt 2.86e-02
asin 4.76e-02
acos 4.76e-02
atan2 3.12e-02
atan 1.82e-02
sin 2.04e-02
cos 2.22e-02
tan 2.27e-02
sinh 3.57e-02
cosh 3.33e-02
tanh 3.57e-02
frexp 2.41e-03
log10 2.56e-02
log 2.50e-02
pow 1.00e-01
ceil 4.39e-03
floor 3.58e-03
modf 4.74e-03
fmod 2.79e-03

Jared Russell
03-02-2008, 01:13
Those numbers look about how I'd expect them for the most part.

What's a little strange to me, however, is that floor() and ceil() aren't faster. Those are pretty trivial functions to implement.

If you have the interest, you should try using some of the CORDIC libraries available on Delphi and see how the speed compares.