-
-
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
sign((-1)//typemin(Int)) != sign(typemin(Int)//(-1)) #32443
Labels
rationals
The Rational type and values thereof
Comments
JeffreySarnoff
changed the title
sign((-1)//typemin(Int)) != sign(typemin(Int)//(-1))
Jun 27, 2019
sign((-1)//typemin(Int)) != sign(typemin(Int)//(-1))
problems seems to be:
|
This is because |
|
Fixed by #32572? |
oscardssmith
pushed a commit
that referenced
this issue
Oct 21, 2023
Fixes #32443 Currently `typemin(Int)//(-1) == typemin(Int)//(1)`, ignoring an overflow. As noted by @JeffreySarnoff in [#32443](#32443 (comment)) This should throw an error instead of silently overflowing. To fix this I am using `checked_neg` instead of `-` in the Rational constructor. With this PR `(-one(T))//typemin(T)` will now also throw an `OverflowError` instead of an `ArgumentError`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and also for the other Signed bitstypes and also for
signbit
.The text was updated successfully, but these errors were encountered: