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 Saturating #43

Merged
merged 1 commit into from
Dec 28, 2017
Merged

implement Saturating #43

merged 1 commit into from
Dec 28, 2017

Conversation

radix
Copy link
Contributor

@radix radix commented Dec 23, 2017

Part of #35.

While in general the test suite does not pass with integers enabled, the new tests do pass, and no new failures were introduced.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.559% when pulling 4b1be3e on radix:saturating into f809cee on iliekturtles:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.559% when pulling 027e8be on radix:saturating into f809cee on iliekturtles:master.

@radix radix changed the title WIP: try to implement Saturating implement Saturating Dec 24, 2017
@radix
Copy link
Contributor Author

radix commented Dec 24, 2017

I've implemented some tests, so this is probably ready for a review (whenever you get a chance, of course!)

Copy link
Owner

@iliekturtles iliekturtles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First pass looks pretty good. Change commit message to "Implement num::Saturating\n\nPart of #35." The standard library also has saturating_mul which num::Saturating doesn't.

src/system.rs Outdated
where
D: Dimension + ?Sized,
U: Units<V> + ?Sized,
V: $crate::num::Saturating + $crate::num::Num + $crate::Conversion<V>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move Saturating after Conversion<V>.

src/system.rs Outdated
{
fn saturating_add(self, v: Self) -> Self {
Quantity {value: self.value.saturating_add(v.value), ..self}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a blank link after the closing }.

src/system.rs Outdated
V: $crate::num::Saturating + $crate::num::Num + $crate::Conversion<V>,
{
fn saturating_add(self, v: Self) -> Self {
Quantity {value: self.value.saturating_add(v.value), ..self}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space before value. Space after ..self.

src/system.rs Outdated
Quantity {value: self.value.saturating_add(v.value), ..self}
}
fn saturating_sub(self, v: Self) -> Self {
Quantity {value: self.value.saturating_sub(v.value), ..self}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space before value. Space after ..self.

@iliekturtles
Copy link
Owner

Could you also add details to CHANGELOG.md. If you rebase on top of master you'll see the notes I just added for #26.

@radix
Copy link
Contributor Author

radix commented Dec 27, 2017

Thanks for the comments! I've addressed them and updated the branch.

@iliekturtles
Copy link
Owner

Could you move mod int ... just above mod float ... and make sure there is no blank line after the mod system_macro .... Will merge once complete!

@radix
Copy link
Contributor Author

radix commented Dec 28, 2017

Done! Thanks for the reviews :)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.559% when pulling d31227d on radix:saturating into 641ebe5 on iliekturtles:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.559% when pulling d31227d on radix:saturating into 641ebe5 on iliekturtles:master.

@radix
Copy link
Contributor Author

radix commented Dec 28, 2017

Looks like Appveyor found a pre-existing bug. Filed #48.

@iliekturtles iliekturtles merged commit 6745365 into iliekturtles:master Dec 28, 2017
@iliekturtles
Copy link
Owner

Thanks!

@radix radix deleted the saturating branch December 28, 2017 15:11
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