-
Notifications
You must be signed in to change notification settings - Fork 35
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
implement a fast atan approximation function #1583
Conversation
Not sure why hip failed to compile. Also I kept the volatile qualifier for testing because runtime wouldn't increase with iteration otherwise. |
I suspect the HIP failure is due to changes in ROCm and there is a namespace clash now. |
can you try not including |
or alternately, include |
It's probably this line:
|
|
indeed, we should get rid of those |
I figured checking nan is unnecessary, so I removed it and also removed |
I've been looking at the screening code a bunch for the autodiff stuff, and I think we may want to include the third-order term in the Taylor series, since we do |
sounds good to me |
implement a fast atan function using an approximate function for x in [-1, 1], for |x| > 1, the identity
arctan(x) = sign(pi/2, x) - arctan(1/x)
(Thanks to Eric) is used.Two versions of the approximate functions are included.
Generally I find the form from stackoverflow is more accurate and also faster. 1) is also discussed in 2).
In general, from testing, atanf is roughly more than 2 times faster than std::atan.