Skip to content
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

Integers not correctly handled in num::rational #11

Closed
rust-highfive opened this issue Sep 28, 2014 · 1 comment
Closed

Integers not correctly handled in num::rational #11

rust-highfive opened this issue Sep 28, 2014 · 1 comment

Comments

@rust-highfive
Copy link

Issue by tbu-
Saturday Aug 09, 2014 at 13:25 GMT

For earlier discussion, see rust-lang/rust#16386

This issue was labelled with: in the Rust repository


  • Possible-machine integers are treated as mathematical integers: Ratio::reduce, where the unary minus operator on a negative number is assumed to yield a positive number.
  • self.denom is compared to Zero::zero instead of calling is_zero().
  • Ratio::recip might return a fractions with a denominator of 0.

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, yielding 1/0.

This might mean that Rust needs some general guideline on how to treat integer overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants