-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support rounding of UnitScalars in Python 3 #84
Comments
|
I'm not 100% convinced that rounding makes sense for values with units, or at least, not in a way that fits the How about a utility function |
@JCorson Question about your expectations. If you have:
then
What would you want |
Understanding the usecase will definitely help us in deciding whether or not to support or how to support this functionality. |
|
Sorry about that, I should have been clearer on the use case. We have been using UnitScalars in the project and many tests use |
I'd consider the fact that this works in Python 2.7 to be a bug in
The other part of this is due to the existence of |
To be clear, I'm a strong -1 on the idea of supporting |
Make sense, and either way works for me. We have already gone through and made all tests use
It is easy enough for us to just right a function to do the comparison that we want. |
Yep, that's what I assumed you meant. When you do that, the underlying code first subtracts those two UnitScalar values (getting another UnitScalar as the difference), and then compares that difference (or rather the absolute value of the difference) to a float, in this case I'd suggest a custom assertion |
Yup. Sounds good to me. |
I had some general assertion functions to do what you want I believe so I pushed it as a PR: #85 . |
I also opened an issue #86 for the comparison of incomparable quantities. |
In Python 3, I am seeing the following when attempting to round a
UnitScalar
.Is this expected?
This is with scimath 4.2.0.
The text was updated successfully, but these errors were encountered: