-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Integers not correctly handled in num::rational
#16386
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
Comments
#8466 is related. |
This issue has been moved to the RFCs repo: rust-lang/rfcs#337 |
This issue has been moved to the RFCs repo: rust-num/num#11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ratio::reduce
, where the unary minus operator on a negative number is assumed to yield a positive number.self.denom
is compared toZero::zero
instead of callingis_zero()
.Ratio::recip
might return a fractions with a denominator of0
.There are also some issues regarding overflows, it seems the module just hopes that they won't happen at all – except for wrong results, this could also raise a
fail!()
ure, when e.g.1/sqrt(max_int)
is multiplied with itself, yielding1/0
.This might mean that Rust needs some general guideline on how to treat integer overflow.
The text was updated successfully, but these errors were encountered: