For pretty much all types T <: Number, calling T(x) and convert(T, x) are equivalent. However, for dimensionless unitful quantities, this is not the case:
julia> Float64(5u"mm/m")
5.0 mm m^-1
julia> convert(Float64, 5u"mm/m")
0.005
I think this is confusing and should at least be documented.
I also think that it’s very unfortunate that the Float64 constructor does not actually return a value of type Float64. I would rather have a dedicated function for converting the numerical value of a quantity to a different type. Of course, this can only be changed in 2.0.
For pretty much all types
T <: Number, callingT(x)andconvert(T, x)are equivalent. However, for dimensionless unitful quantities, this is not the case:I think this is confusing and should at least be documented.
I also think that it’s very unfortunate that the
Float64constructor does not actually return a value of typeFloat64. I would rather have a dedicated function for converting the numerical value of a quantity to a different type. Of course, this can only be changed in 2.0.