Open LKuhrmann opened 1 week ago
This doesn’t work because u"1/km"
is a quantity, not a unit. You can use u"km^-1"
instead.
Duplicate of #720.
I see, that wasn't obvious to me. I thought only if there is something before the u Unitful creates a quantity, but I misunderstood.
Maybe an Error message like "Can not unconvert a quantity to another quantity, only to a unit." would be helpful? In my opinion the current error message is not intuitive.
Maybe somthing like the following could be added to uconvert in conversion.jl:
function uconvert(x::Quantity{T,D,U}, y::Quantity{T,D,U})
error("Can not unconvert a quantity to another quantity, only to a unit.")
end
What do you think? Either way, thanks a lot for the help!
Hi all, I hope this is not a repeat question.
I am trying to do an operation equivalent to this, but it does not work:
uconvert(u"1/km", 1.0u"S" * 1.0u"Ω" * 1.0u"1/km")
However, similar situations where units cancel each other out work just fine:
uconvert(u"Ω/km",1.0*u"1/km" * 1.0u"V"/1.0u"A")
Is this a bug or am I misunderstanding what this package can do? Should I be using a different function?
Thanks!