Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructor/conversion for dimensionless quantities #358

Open
sostock opened this issue Jun 15, 2020 · 0 comments
Open

Constructor/conversion for dimensionless quantities #358

sostock opened this issue Jun 15, 2020 · 0 comments
Labels
dimensionless dimensionless quantities/units (mm/m, rad, …) and their interaction with plain numbers

Comments

@sostock
Copy link
Collaborator

sostock commented Jun 15, 2020

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.

@sostock sostock added the dimensionless dimensionless quantities/units (mm/m, rad, …) and their interaction with plain numbers label Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dimensionless dimensionless quantities/units (mm/m, rad, …) and their interaction with plain numbers
Projects
None yet
Development

No branches or pull requests

1 participant