Is there any other way to calculate arc cosine (I am using VS2010 in a standard C++ project) faster?
Or is there any other possible engineering to make the program faster?
Are you testing with a release build? I'm not sure about VS2010, but in previous versions the default project settings did not perform full optimization. Check the project settings, most importantly those under C/C++ --> Optimization.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
calculating a log() is slow. not much you can do about that.
If you're doing lots of acos calculations, then you can speed things up by making a table of acos over a certain range with a certain step and use interpolation to calculate the value of an acos() call.
Depending on needed accuracy and range, you may end up needing a very big table though.
Since you mention 'slow' I'm asuming you're calling acos() thousands/millions of times? You probably need to look at ways to remove the acos() call out of your inner loops rather than trying to optimise the acos() call itself.
Bookmarks