Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

asbase is inconsistent with prefixed base units #7

Open
ggggggggg opened this issue Mar 11, 2015 · 4 comments
Open

asbase is inconsistent with prefixed base units #7

ggggggggg opened this issue Mar 11, 2015 · 4 comments

Comments

@ggggggggg
Copy link
Owner

julia> asbase(Gram)
0.001 kg 

julia> asbase(Newton)
1000.0 g s⁻²m

These should both go to kg.

@ggggggggg
Copy link
Owner Author

Simpler case

julia> KiloGram*KiloGram
1.0e6 g²

It has to do with remove_prefix not knowing about prefixed base units.

@gr225607
Copy link

For:
E=2.409866751432028e-24 g⁻¹J²s²m⁻²
E1=as(E,eV)
equals E1=1.504120584507506e-8 eV
This is wrong!

Should be 0.0150412053 eV

I think in has to do with the g unit

I think in has to do with default, const KiloGram = BaseUnit("g", prefix=3)
Why is this not in kg?

Update:
Yes this worked. Change the a_si_plus.jl file to reflect the above [KiloGram = BaseUnit("kg")]. I'm new to github, so not sure how to change/ or if possible to change the master. Also, this change may affect others...

Rant: Was so close to going back to maple... but I must say, it is very nice to be able to update the source file, the potential is limitless :) Thanks for the package

@ggggggggg
Copy link
Owner Author

The base unit is prefixed g instead of kg, because it's easier to support prefixes other than k. If I used kg without a prefix, then a gram would be mkg (milli kg). At least the way I programmed it. Prefixed base units turned out to be way trickier than I expected. I'll take another look at it.

@ggggggggg
Copy link
Owner Author

I fixed your example. I'm leaving the issue open because it was actually a different (but more serious) issue than the original. The original is just a cosmetic issue.

c8266e3

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

No branches or pull requests

2 participants