Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement abs for size and vector types. #232
Conversation
|
r? @kvark it'd be nice to have a method for size that would clamp all negative components to zero, since that's the other common interpretation of negative sizes (depending on the context). I don't know how that method would be called. |
|
Looks fine by me. Have you considered implementing |
|
I was on the edge and wasn't sure whether it would be controversial. I can definitely do it if you have a preference towards it. That means implementing: fn abs(&self) -> Self;
fn abs_sub(&self, other: &Self) -> Self;
fn signum(&self) -> Self;
fn is_positive(&self) -> bool;
fn is_negative(&self) -> bool;I am not sure what the most sensible thing is for
|
|
Oh, I assumed at least some of those are not required to implement. Nevermind then :) |
|
|
Implement abs for size and vector types. Fixes #231. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/232) <!-- Reviewable:end -->
|
|
Version 0.15.5. Forgot to increment the version number in #232. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/233) <!-- Reviewable:end -->
nical commentedNov 7, 2017
•
edited by larsbergstrom
Fixes #231.
This change is