Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Quality of Exponential and Logarithm Functions #39

Open
kphillisjr opened this issue Sep 5, 2018 · 2 comments
Open

Improving Quality of Exponential and Logarithm Functions #39

kphillisjr opened this issue Sep 5, 2018 · 2 comments

Comments

@kphillisjr
Copy link

kphillisjr commented Sep 5, 2018

I was looking over the various math functions and noticed that there is a lot of error in the implementation of the Logarithm and Exponential functions. This is after applying the Intrinsic-free version of the square root function.

// The Square-Root Function.
sqrtf(x);
// Fast and Simple alternative... 
expf(0.5f*logf(x));

// the Power function
powf(a, b);
// alternative method:
expf(b*logf(a));

Now as far as improving the Accuracy of the Exponential and Logarithm Functions. I suggest looking into the work completed by Ping Tak Peter Tang in the following series of articles from the early 1990s and late 1980s.

  • Table-driven implementation of the Expm1 function in IEEE floating-point arithmetic. ACM Transactions on Mathematical Software 18(2): 211-222 (1992)
  • Table-lookup algorithms for elementary functions and their error analysis. IEEE Symposium on Computer Arithmetic 1991: 232-236
  • Accurate and efficient testing of the exponential and logarithm functions. ACM Transactions on Mathematical Software 16(3): 185-200 (1990)
  • Table-driven implementation of the exponential function in IEEE floating-point arithmetic. ACM Transactions on Mathematical Software ( 15(2): 144-157 (1989)

Edit: Added note about alternative method for calling the pow function.

@gingerBill
Copy link
Owner

I was looking over the various math functions and noticed that there is a lot of error in the implementation of the Logarithm and Exponential functions. This is after applying the Intrinsic-free version of the square root function. ...

@kphillisjr these functions are meant to be fast operations rather than precise ones. They are to be used when x is small.

Sent with GitHawk

@kphillisjr
Copy link
Author

Thanks for the response, and I found a good alternative ( see: https://github.com/yui0/slibs/blob/master/fmath.h ). I just have not tested the overall speed just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants