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

Implement OpAssign for Complex #274

Merged
merged 4 commits into from
Jul 12, 2017
Merged

Conversation

bluss
Copy link
Contributor

@bluss bluss commented Apr 2, 2017

Design choice: Use by-value forms of OpAssign and use Clone to forward the reference arguments. That matches what the other traits do (for example Add).

Design choice: The complex += complex operation needs Add, not just AddAssign. The complex += real operation can use just AddAssign. You could just use Add for both, not sure which way is preferable.

@bluss
Copy link
Contributor Author

bluss commented Apr 2, 2017

#186's revival.

This PR has not properly taken the previous given feedback in review, it should be incorporated. Go for more consistent requirement of Assign traits.

@cuviper
Copy link
Member

cuviper commented Apr 3, 2017

Are you opposed to now adding a NumAssign trait, as discussed before? Then each of these should require a full T: Clone + NumAssign.

@bluss
Copy link
Contributor Author

bluss commented Apr 3, 2017

NumAssign sounds great.

@cuviper
Copy link
Member

cuviper commented Apr 24, 2017

NumAssign is in #283.

@cuviper
Copy link
Member

cuviper commented May 24, 2017

Can you update this to use NumAssign?

@atilag
Copy link

atilag commented Jun 28, 2017

Would love to see this PR landing. Thanks for the effort!!

@cuviper
Copy link
Member

cuviper commented Jul 12, 2017

Rebased and applied NumAssign. Thanks!

bors r+

bors bot added a commit that referenced this pull request Jul 12, 2017
274: Implement OpAssign for Complex r=cuviper

Design choice: Use by-value forms of OpAssign and use Clone to forward the reference arguments. That matches what the other traits do (for example Add).

Design choice: The complex += complex operation needs Add, not just AddAssign. The complex += real operation can use just AddAssign. You could just use Add for both, not sure which way is preferable.
@bors
Copy link
Contributor

bors bot commented Jul 12, 2017

Build succeeded

@bors bors bot merged commit d57c0c2 into rust-num:master Jul 12, 2017
@bluss
Copy link
Contributor Author

bluss commented Jul 16, 2017

Thank you -- I'm sorry I was absent.

@bluss bluss deleted the complex-opassign branch July 16, 2017 20:06
bors bot added a commit to rust-num/num-rational that referenced this pull request Jan 26, 2018
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?
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

Successfully merging this pull request may close these issues.

3 participants