-
Notifications
You must be signed in to change notification settings - Fork 57
Implement OpAssign for Ratio #12
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
I think it should though, because un-reduced ratios make overflow (#13) even worse. To call I notice that you added integer support, |
Thanks! Although it costs a few more instructions, |
Can you merge or rebase your branch? I think your changes are colliding with #11. |
src/lib.rs
Outdated
@@ -1253,17 +1449,6 @@ mod test { | |||
fn test_div_0() { | |||
let _a = _1 / _0; | |||
} | |||
|
|||
#[test] | |||
fn test_checked_failures() { |
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.
It seems this test was accidentally removed in your merge?
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.
Wow! That was bad of me :(
Now you pulled in a (If you have trouble with this, I may be able to push such an update to your PR myself.) |
I rewrote history to make things cleaner. |
Great, thanks! bors r+ |
12: Implement OpAssign for Ratio r=cuviper a=c410-f3r Copied shamelessly from [#274](rust-num/num#274) but fixes #5. There is only one problem to solve before anything. Since the implementation doesn't use the `reduce` function, it is possible to exist multiple types of zeros (`0/4`, `0/21`, `0/66`) instead of the default `0/1`, which implies in test errors like `test(_1_2, _NEG1_2, _0);`, therefore, should I rewrite the test suite to be more "zero" friendly?
Build succeeded |
Copied shamelessly from #274 but fixes #5.
There is only one problem to solve before anything. Since the implementation doesn't use the
reduce
function, it is possible to exist multiple types of zeros (0/4
,0/21
,0/66
) instead of the default0/1
, which implies in test errors liketest(_1_2, _NEG1_2, _0);
, therefore, should I rewrite the test suite to be more "zero" friendly?