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

uconvert issue #661

Closed
cmichelenstrofer opened this issue Jul 4, 2023 · 2 comments
Closed

uconvert issue #661

cmichelenstrofer opened this issue Jul 4, 2023 · 2 comments

Comments

@cmichelenstrofer
Copy link
Contributor

This works

julia> uconvert(u"s^-1", 3u"Hz")
3 s⁻¹

but this doesn't

julia> uconvert(u"1/s", 3u"Hz")
ERROR: MethodError: no method matching uconvert(::Quantity{Int64, 𝐓⁻¹, Unitful.FreeUnits{(s⁻¹,), 𝐓⁻¹, nothing}}, ::Quantity{Int64, 𝐓⁻¹, Unitful.FreeUnits{(Hz,), 𝐓⁻¹, nothing}})

Closest candidates are:
  uconvert(::Any, ::Base.TwicePrecision)
   @ Unitful ~/.julia/packages/Unitful/orvol/src/range.jl:117
  uconvert(::Unitful.Units, ::Quantity{T, D, U}) where {T, D, U}
   @ Unitful ~/.julia/packages/Unitful/orvol/src/conversion.jl:72
  uconvert(::Unitful.Units, ::Number)
   @ Unitful ~/.julia/packages/Unitful/orvol/src/conversion.jl:82
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[14]:1

Am I doing something wrong or is this a bug?

@sostock
Copy link
Collaborator

sostock commented Jul 5, 2023

This is because 1/s is a quantity, not a unit.

@cmichelenstrofer
Copy link
Contributor Author

Ahh! That makes sense. Thanks!

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