I think automatic conversion is not recommended and so the Unitful devs opted for not doing it. For SI units conversion, I think upreferred generally does the trick:
julia> a = 1u"m" / 1u"cm"
1.0 m cm^-1
julia> upreferred(a)
100.0
julia> b = 1.0u"inch"
1.0 inch
julia> upreferred(b)
0.0254 m
But I think being explicit with your conversion is probably a better idea, and the pipe operator offers nice syntax for this IMHO:
julia> a |> unit(1) # maybe there is a better unitless unit
100.0
julia> b |> u"m"
0.0254 m
Thank you very much for your replies. Yes, I concluded the same, but was wondering whether I had missed some capability. I appreciate the quick response!
Thanks. Is there a method to convert any unit into SI units? So far, all I seen is how to convert from one unit to another, but I have to specify the target units.
I think the problem is that saying “convert to SI” isn’t specific enough. Do you want Newtons? Or kg*m/s^2? I think that’s why you have to specify.
It’s easy to convert to base SI units without ambiguity. The base units are m, s, kg, K, A, mol, cd. The odd one out is kg, the others are without prefix.