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

Fix uconvert For Inverse Units #338

Closed
acdupont opened this issue May 27, 2020 · 4 comments
Closed

Fix uconvert For Inverse Units #338

acdupont opened this issue May 27, 2020 · 4 comments

Comments

@acdupont
Copy link

uconvert does not calculate the correct value for inverse units.

This works as expected:

julia> uconvert(u"m^3", 1000000.0u"cm^3")
1.0 m^3

When using inverse units, I expected the value 1.0 m^-3 but got this instead

julia> uconvert(u"m^-3", 1000000.0u"cm^-3")
1.0e12 m^-3
@giordano
Copy link
Collaborator

@briochemc this works on v1.2.0 but not v1.2.1. Looks like #335 wasn't enough

@acdupont
Copy link
Author

hmm, I think my logic is wrong. if there are 1000000 "things" per cm^3, then there will be a magnitude more than that in a m^3, so it looks like Unitful's answer here actually is correct.

@giordano
Copy link
Collaborator

Also, I was testing the wrong function in the REPL 😑 The result is consistent across all versions v1, v1.1, v1.2.0, v1.2.1. @briochemc Sorry for the noise!

@giordano
Copy link
Collaborator

hmm, I think my logic is wrong. if there are 1000000 "things" per cm^3, then there will be a magnitude more than that in a m^3, so it looks like Unitful's answer here actually is correct.

Yes, this is a volumetric density, so if you go to a larger volume you expect "more stuff", and the factor 10^6 when going from a volume of 1cm^3 to 1m^3 looks indeed correct. Ok, I think we can close this ticket.

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

No branches or pull requests

2 participants