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

Integer division being used when dividing two dimensionless quantities. #47

Open
mdickinson opened this issue Apr 4, 2016 · 1 comment
Labels

Comments

@mdickinson
Copy link
Member

There are some surprising results when doing divisions with dimensionless quantities.

>>> from scimath.units.SI import *
>>> dimensionless / dimensionless
1
>>> type(dimensionless / dimensionless)
<type 'int'>
>>> dimensionless / (2*dimensionless)
0

I'd expect float and 0.5, here.

I also find it surprising that a multiplication or division with a unitless result returns a scalar (int or float) rather than another scimath.units.unit.unit instance, but that's another issue.

@mdickinson mdickinson added the Bug label Apr 4, 2016
@mdickinson
Copy link
Member Author

So dimensionless.value is 1, which is part of the cause. Changing that feels a bit risky; I'd suggest that instead we change the division semantics so that values are divided using operator.truediv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant