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
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.
The text was updated successfully, but these errors were encountered:
sostock
added
the
dimensionless
dimensionless quantities/units (mm/m, rad, …) and their interaction with plain numbers
label
Dec 14, 2022
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
Float64
constructor 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.The text was updated successfully, but these errors were encountered: