This forum has been archived. All content is frozen. Please use KDE Discuss instead.

exp2() and log2() ?

Tags: None
(comma "," separated)
twithaar
Registered Member
Posts
23
Karma
0

exp2() and log2() ?

Sun Nov 02, 2014 2:28 pm
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.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: exp2() and log2() ?

Thu Nov 06, 2014 6:50 am
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?
twithaar
Registered Member
Posts
23
Karma
0

Re: exp2() and log2() ?

Sat Nov 08, 2014 8:57 am
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.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]