-
Notifications
You must be signed in to change notification settings - Fork 11
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
Wrong unit representation when multiplying a composed unit #15
Comments
This also fails and seems to be related: from barril.units import Scalar
u1 = Scalar(1, 'kg/m3')
print(u1.GetValue(u1.unit))
u2 = Scalar(1, 'kg/m3') * Scalar(1, 'm3')
print(u2.GetValue(u2.unit)) Output:
So a composed scalar can't convert to its own unit, it seems. @fabioz any hints here? |
This is a known limitation at this moment (when dealing with units which are composed we don't automatically simplify the quantity type and have to work with a different API). i.e.: the following works.
Regarding the way the unit should be shown to add the parenthesis to be more explicit, that should be reasonable to do (note that I don't consider any of those bugs, rather feature requests for a different behavior as it's working as intended). |
EDIT moved the discussion about simplification over to #16, this issue is about the bug in the original post which should be fixable according to @fabioz. 👍 I think we are talking about 3 different things (and sorry because my comment might have added to the list):
From my POV, 1 is a feature request, while 2 and 3 are clearly bugs.
If the bugs are complex to solve or not is another matter, but from a user's point of view they are bugs IMO. Have no idea about how complex is to fix 1, but seems minor if 2) and 3) work as then 1) becomes almost an implementation detail. What do you guys think? |
I agree with @nicoddemus, to me 2 and 3 look like bugs, specially considering that |
1.3.0
3.6.6
Windows 10 64-bits
Description
When you multiply a ratio unit by another unit, the new unit representation is wrong.
For example:
kg/m3 * m3
should result (ideally) inkg
or something like(kg . m3) / m3
, but Barril outputskg/m3.m3
, here:The text was updated successfully, but these errors were encountered: