-
-
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
Revert broadening of arithmetic Any
methods (revert #44564 and #45320)
#45489
Conversation
Any
methods (Revert #44564 and #45320)
Any
methods (Revert #44564 and #45320)Any
methods (revert #44564 and #45320)
I thought the objections were against the (remaining) generic one- and two-arg |
Hm, the julia> eltype(one(Int32) \ one(Float32))
Float64
julia> eltype(one(Int64) \ one(Float32))
Float64 On v1.7: julia> eltype(one(Int32) \ one(Float32))
Float32
julia> eltype(one(Int64) \ one(Float32))
Float32 The reason is that the most generic \(x::Number, y::Number) = \(promote(x,y)...) because that causes a stack overflow since there is no float equivalent that catches the promoted call. One might view that as another reason to merge this PR (and revert the others). |
I had a failing test in one of my packages and narrowed it down to a change in left division after #44564: julia> a = BigFloat(1)
1.0
julia> 3 \ a
0.333333333333333314829616256247390992939472198486328125 There is loss of accuracy because left division started doing |
Ok, then it's clear that this here needs to be merged. I resolve the merge conflict and merge after tests pass, unless someone beats me to it. One conclusion from this whole tour then is that we should be clearer in the docstrings for left-division about what the actual fallback is. The |
To be fair, I should be careful anyway about assuming that (In general, division might be safer than computing an inverse, but I did not think this through.) |
The |
…and JuliaLang#45320) (JuliaLang#45489) * Revert "Remove type-unlimited unary `+` and `*` (JuliaLang#45320)" This reverts commit 990b1f3. * Revert "Generalize or restrict a few basic operators (JuliaLang#44564)" This reverts commit cf1f717. Also fixes merge conflicts in stdlib/LinearAlgebra/test/generic.jl Co-authored-by: Daniel Karrasch <[email protected]>
…and JuliaLang#45320) (JuliaLang#45489) * Revert "Remove type-unlimited unary `+` and `*` (JuliaLang#45320)" This reverts commit 990b1f3. * Revert "Generalize or restrict a few basic operators (JuliaLang#44564)" This reverts commit cf1f717. Also fixes merge conflicts in stdlib/LinearAlgebra/test/generic.jl Co-authored-by: Daniel Karrasch <[email protected]>
See #45463 for context.
Reverts #44564 (reverts cf1f717)
Reverts #45320 (reverts 990b1f3)
Fixes #45463