ggggggggg / Physical.jl

Units, physical constants, error propagation.
MIT License
7 stars 5 forks source link

round function does not work #8

Closed gr225607 closed 8 years ago

gr225607 commented 8 years ago

Doing: round(5nm,2)

Give Error: convert has no method matching convert(::Type{FloatingPoint}, ::Quantity{Int64}) while loading In[22], in expression starting on line 4

in round at floatfuncs.jl:85 in anonymous at no file:6

ggggggggg commented 8 years ago

Added round(x::Quantity,y). Does it do what you expect? ba39b99d8621186d22869ecd79a7dd8ba6ba70b5

gr225607 commented 8 years ago

No, not working for me.

I try: k1=0.6283185307179586 nm⁻¹ round(k1,2)

Gives error: convert has no method matching convert(::Type{FloatingPoint}, ::Quantity{Float64}) while loading In[81], in expression starting on line 1

in round at floatfuncs.jl:85

Looking for: 0.63 nm⁻¹

Same issue with the absolute value. I get an error when doing: abs(x) if x is negative and has units.

I believe the package is updated. Once the package is cloned, pkg.update() should updated the changes made to the package, correct?

ggggggggg commented 8 years ago

According to this http://web.mit.edu/julia_v0.3.11/.julia-483dbf5279.amd64_ubuntu1404/share/julia/doc/_build/html/manual/packages.html unregistered packages are not updated by Pkg.update. I think you need to delete the directory and re-clone.

This is what I get

julia> k1 = 0.6283185307179586 / (Nano*Meter)
0.6283185307179586 nm⁻¹

julia> round(k1,2)
0.63 nm⁻¹

Do you want to add the abs function? If you just look at the commit link in my last post you can see how I did the round function, it should be very similar.

gr225607 commented 8 years ago

Okay, I'll give it a try. I should be able to add the abs function. Thanks!