-
Notifications
You must be signed in to change notification settings - Fork 50
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
Smarter comparisons #49
Comments
Is there a way that you created Regardless, we should fix this, just as the general comparison doesn't assume they are reduced. Would you like to send a PR? Note that using |
I encountered it in testing after removing a call to I would be happy to submit a PR for this, but I'd like to mostly finish #42 first. |
51: Fix #49 r=cuviper a=maxbla fixed issue #49 added a test case for it Side note: `cmp` is a bit scary. Do we know what it's amortized runtime is? It seems to me that the worst case (having to compare the reciprocals many times) could be pretty bad. Is there any way to have a separate `impl` for `T: Clone + Integer + CheckedMul`? As the comments note, CheckedMul would make the implementation faster. I messed around, but I can't find a way to have two implementations -- one for checked and one for no checked. I found an [this](rust-lang/rfcs#586) RFC for negative trait bounds though (spoiler: negative trait bounds are not happening soon). Co-authored-by: Max Blachman <blachmanmax@gmail.com>
Ratio{numer:0, denom:1}
is not equal toRatio{numer:0, denom:2}
The code that appears to deal with this is
It seems like we could easily add a case for
self.numer == T::zero()
, but this ties in with #8 and I don't see a need to rush a fix.The text was updated successfully, but these errors were encountered: