![]() Registered Member ![]()
|
In the C++11 standard, exp2() and log2() are added. Those are potentially much fast than exp() and log().
On [url] https://bitbucket.org/thijs_withaar/eig ... 292c3b422e [/url] I've added SSE2 versions of those functions, based on http://jrfonseca.blogspot.nl/2008/09/fast-sse2-pow-tables-or-polynomials.html Is there any interest ? If so, I can work on it a bit more, by cleaning up and adding more tests. |
![]() Moderator ![]()
|
yes, in theory this might be interesting to integrate within Eigen, but what is the accuracy? Is-it conform to ieee754? Or does it loss 1, 2, 3, more bits of precision?
|
![]() Registered Member ![]()
|
It turns out that the accuracy of the 3rd order polynomial as a few orders of magnitude worse than machine precision.
So it's also orders of magnitude worse in precision than the cephes implementation of log() currently used in Eigen. Also, the single cascaded polynomial is very unfriendly to CPUs with a large pipeline. I did not do performance test myself yet, but this alone might make it slower than using Eigen::log(). I'm experimenting a bit with higher order remez-fits at the moment, to fit a group of polynomials which should not stall the pipeline as much, but results are not yet close to the Cephes-log() version. For anyone wanting to play with this: The least-square fitter in python's scipy is for some reason very sensitive to numerical errors. Eigen's JacobiSVD gives much better results. Also, the fit as performed by jrfonseca in the link above does not seem to be weighed correctly. With the same number of coefficients, I can get a 50% better abs. and relative max-error. If I ever manage to produce a decent set of polynomials, I'll post it here again. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]