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
It appears that calling one on quantity types outputs the one of the backing type. By contrast, zero will output the zero of the quantity, e.g:
julia> Q =typeof(1.0u"m")
Quantity{Float64,𝐋,Unitful.FreeUnits{(m,),𝐋,nothing}}
julia>zero(Q)
0.0 m
julia>one(Q)
1.0
Not sure if I should be using a different method to obtain the unitary element of the type, but I believe these two methods should provide the same type.
The text was updated successfully, but these errors were encountered:
julia>oneunit(Q)
1.0 m
help?> oneunit
search: oneunit DimensionlessQuantity
oneunit(x::T)
oneunit(T::Type)
Returns T(one(x)), where T is either the type of the argument or (if a type
is passed) the argument. This differs from one for dimensionful quantities:
one is dimensionless (a multiplicative identity) while oneunit is
dimensionful (of the same type as x, or of type T).
It appears that calling
one
on quantity types outputs the one of the backing type. By contrast,zero
will output the zero of the quantity, e.g:Not sure if I should be using a different method to obtain the unitary element of the type, but I believe these two methods should provide the same type.
The text was updated successfully, but these errors were encountered: