-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add a fourthroot
function with unicode symbol ∜
#48899
Conversation
Looks good to me! For reference, worst case accuracy on |
Is there anything else I need to do to merge this PR? (Sorry, this is my first time contributing to Julia) |
Thanks for the contribution! |
No problem! Hopefully I can contribute more in the future :) |
It is faster, but can it be done even faster? And more importantly, would it be more accurate to do some other way, than twice sqrt? Is the version in the PR at least as accurate as to power of 1/4? I discovered at least 4th power is 6.7x slower
|
I believe it can not be done faster (although that is rather difficult to bemchmark). It is less accurate than
|
is 4.7 times slower, so I give up. Unless some faster log is possible? And FYI, I added the faster pow4c above in my edited comment, seems it should be the default for such (literal) power in Julia?! |
The one thing that might be faster is some bithacks to get an approximate fourth route and use newton iterations to hit the tolerance, but I doubt that will be quicker due to the required divisions. 2 ULP is above our normal error tolerance. We could probably make |
* adds fourthroot function
I noticed that there's a unicode symbol for the fourth root (∜) but there's no fourth root defined in
Base
. This PR adds afourthroot()
function that simply appliessqrt()
twice in a row and defines∜ = fourthroot
.In my opinion two advantages of this are that
x^(1/4)
, which is less efficient than this new function: