-
Notifications
You must be signed in to change notification settings - Fork 24
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
return type of float(x)
#14
Comments
Excited to see what others think about this issue. cc: @StefanKarpinski |
See also JuliaLang/julia#1470. |
I definitely agree that e.g. |
I explicitly did not define the convert method, because I didn't want to the units to ever by explicitly stripped. We tend to allow
This of course raises the question of how do get the value of a unitful quantity in general |
Ugh, that is a pickle. Having The problem is that conversion of |
Bear with me if this is already implemented somewhere, but I couldn't find it (I don't have Julia installed on this computer, so I couldn't check with Why not just have a If one then wants floating point values, specifically, one would have to do e.g. |
I would tend to argue that this should preserve the units, even though
SIQuantity
is not a subtype ofFloatingPoint
. e.g.float(1V)
should give1.0V
.Not only is the current behavior somewhat counter-intuitive, but it also makes type-stable promotion code just way too tricky to write in a way that preserves the units. (See e.g. SciML/ODE.jl#26, but this also shows up in norm computation and probably other places.)
The text was updated successfully, but these errors were encountered: