-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
See if we can remove mathematically iffy Complex rounding modes #52490
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
Conversation
No, because the remaining ones also aren't justified. The notions described in the docstrings of the rounding modes for Real numbers don't extend to complex numbers, because the tiebreakers listed there don't resolve the ambiguities at all. At the very least, they aren't even consistent with what |
IMO Sukera's approach is better, but, in case this approach gets accepted instead, I think it would be much better for |
This PR doesn't add the ability for |
I think #51192 & doc build failures combine to prevent nanosoldier from running on this PR as is. The concept of "nearest" makes sense for complex numbers. The concepts of "toward zero" and "away from zero" make sense as tie breakers, though when used alone we have to define their behavior explicitly elementwise (magnitude of differences are insufficient). For example, if we were to define "Toward even" is iffy, but rounding tiebreakers are imo significantly less important than the primary round/floor/ceil distinction. And it may be too breaking to remove |
The whole issue is that you can't extend the notion of rounding elementwise cleanly to |
to be honest, I don't really agree with this. sure, the APL definition sets out some nice declarative properties that I think rounding elementwise honestly feels pretty intuitive for rounding to any lattice in any coordinate space, and is a perfectly reasonable definition, even if some properties only hold when the lattice is one dimensional I mean, I think the equivalence of |
This PR keeps that equivalence by making
That seems reasonable. I also don't see any major problems with elementwise floor, though if it's non-disruptive to remove it that's fine by me as well. |
4d1f7a2
to
660ea37
Compare
if rr in (RoundNearest, RoundFromZero, RoundToZero, RoundNearestTiesAway) | ||
return round(z, rr, rr; kwargs...) | ||
end | ||
error("Rounding Mode $rr not supported for Complex numbers. Use round(z, $rr, $rr)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would throw and ArgumentError
here.
Yes, the whole point of this PR is to bring |
Triage thinks that it is okay to define |
My preferred solution to #51141. Hopefully no one is relying on the bad rounding modes, but this definitely needs a pkgeval to confirm. @Seelengrab would this be OK with you? I believe the remaining rounding modes for the single argument
round
are ones that are relatively mathematically justified.