You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
julia> notsosimple = 1u"m/ft*kg"
1 ft^-1 kg m
julia> upreferred(ans)
1250//381 kg
This may not be what you want though, since the result would be in kg even if the mass unit in the first expression were a different unit. What this does is look at the dimensions of the quantity, and for each power of length, have that many powers of a meter, etc., where the dimension-to-unit mapping is given by the @preferunit macro in the defaults. So this basically is a "convert to base SI units" function given what is usually in deps/Defaults.jl.
If you have different functionality in mind, how would you simplify when you have units of mixed dimensions like joules where it's not just length or mass or time but a combination?
I guess I'm thinking of a function that would simplify units that have the exact same dimensions and leave those that partially overlap. More complex conversions would happen in #35 (for which upreferred would be one instance). I might trial an implementation so we have something concrete to discuss.
@ajkeller34, unless I'm mistaken, the following functionality (
simplify
) does not yet exist. Happy to try and implement it if it doesn't:It should be possible to determine which unit to use of m or ft, the same way it is done for +, via
promote_type
The text was updated successfully, but these errors were encountered: