-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix overflow in complex // #60130
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
base: master
Are you sure you want to change the base?
Fix overflow in complex // #60130
Conversation
some |
|
It would be easy to solve all of these overflows by converting to |
|
I wouldn't say promoting to the fact that something like |
|
@nanosoldier |
|
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed10 packages crashed on the previous version too. ✖ Packages that failed17 packages failed only on the current version.
1503 packages failed on the previous version too. ✔ Packages that passed tests5 packages passed tests only on the current version.
5415 packages passed tests on the previous version too. ~ Packages that at least loaded1 packages successfully loaded only on the current version.
3281 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether902 packages were skipped on the previous version too. |
|
looks like main problem is new ambiguities with methods of |
|
@nanosoldier |
|
There is one remaining test failure in MultiplesOfPi.jl julia> (Pi^-1) |> typeof
PiExpTimes{Float64, Int64}
julia> (Pi^Int(-1)) |> typeof
PiExpTimes{Int64, Int64}Complex{Int}: Error During Test at /home/nathan/.julia/packages/MultiplesOfPi/QLHYm/test/runtests.jl:498
Test threw exception
Expression: Pi ^ -1 // (2im) === (0 // 1 - 1 // 2 * im) * Pi ^ -1
MethodError: no method matching //(::Float64, ::Int64)
The function `//` exists, but no method is defined for this combination of argument types.
Closest candidates are:
//(::Number, ::Complex)
@ Base rational.jl:128
//(::Complex, ::Real)
@ Base rational.jl:107
//(::LinearAlgebra.UniformScaling, ::Number)
@ LinearAlgebra ~/github/julia/usr/share/julia/stdlib/v1.14/LinearAlgebra/src/uniformscaling.jl:290
...
Stacktrace:
[1] //(p::PiExpTimes{Float64, Int64}, y::Int64)
@ MultiplesOfPi ~/.julia/packages/MultiplesOfPi/QLHYm/src/MultiplesOfPi.jl:255
[2] //(x::Complex{PiExpTimes{Float64, Int64}}, y::Int64)
@ Base ./rational.jl:107
[3] //(x::PiExpTimes{Float64, Int64}, y::Complex{Int64})
@ Base ./rational.jl:130 |
|
The package evaluation job you requested has completed - possible new issues were detected. Report summary✖ Packages that failed1 packages failed only on the current version.
✔ Packages that passed tests2 packages passed tests on the previous version too. |
Fixes #53435
With this change, internal calculations may still throw an
OverflowErroreven if the true result would not overflow, but I think this is better than the current behavior of returning the wrong result:Simple benchmarks:
master: 16.122 ns, 59.158 ns
PR: 12.720 ns, 15.447 ns
Edit: I added a suggestion from #60137 so now this PR also fixes #60137 and fixes #56245