-
-
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
fix precision issue in Float64^Float64. #44529
Conversation
I've done local testing on 2^22 random inputs to confirm correctness. For uniform x,y (x in -0:2000, y in -100:100), mean error is now .257 ULP, maximum error found is 1.36 ULP, and only For comparison, 1.7 has slightly worse average error (.262), but better maximum error (.85 ULP) |
How about |
Unchanged, but that is actually a bugfix. In 1.7, |
Also, what do you want in terms of tests for this? It's much harder to exhaustively test this than single argument functions because there are way more possibilities. |
Would be nice to have a slightly more descriptive issue title. |
But now it returns a different result than
|
Yeah. The 2 options are to make |
It kind of feels "embarrassing" to not be able to compute something like 10.0^-3 accurately anymore (this goes for both the literal pow and the floating point version). Any idea what other programming languages do here? Are we the odd one out or is this common? |
I've created https://discourse.julialang.org/t/poll-speed-vs-performance-for-float64-float64/77619 to gauge community opinion here. I'm happy to go either way. |
I've now fixed x^-3 to be more accurate after some democracy, and more careful analysis (I hadn't realized that the fast version's error could get above 2 ULPs). @KristofferC or anyone else that wants to this is ready to review. |
Still need to add tests for all the cases this changed I think? |
tests added. (note that I've run the tests locally with higher parameters, but I've reduced the number a bit to keep CI running faster). |
The tests also caught a minor precision bug for |
Seems to still fail CI. |
You may have to rebase on |
e4c2930
to
0ac4753
Compare
Seems like some other test started failing now. |
this is surprisingly fiddly to get 100% correct. |
This appears to finally be correct. Thanks for catching it before release @KristofferC. |
* improve accuracy for x^-3 (cherry picked from commit 258ddc0)
Closes #44525
this only costs 1
fma
more, so the performance impact is minimal.