-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Should we use Quantity.Scale to prevent certain operations? #167
Comments
Actually multiplication by |
Said otherwise: Wikipedia said that |
Then it seems if ABSOLUTE allows to prevent multiplications of e.g. CELSIUS that seems enough. Let's leave it open if others may have issues with that, but it would be nice to stick with just one |
There should be some https://www.wikihow.com/Convert-Between-Fahrenheit,-Celsius,-and-Kelvin mentions conversions that involve |
I don't think we should throw exception. |
So what is the preferred runtime behavior in this case? So far unitsofmeasurement/indriya#128 in the RI is the only issue that looks like it may use the scale. |
I don't know what is "same as before". The scale is used for determining how to convert to
Implementation is free to convert the result back to °C if they wish. My proposal is to keep the result of 1 in kelvin for less surprising behavior. |
Ok but it would not be prevented e.g. by throwing an Btw. @desruisseaux could you add the last comment in the right form to unitsofmeasurement/indriya#128, I think it makes most sense there. |
I see no need for |
Thanks, then let's close this with wontfix. |
There was a question at OOP (@filipvanlaenen will remember) about preventing e.g. the
multiplication
ofCELSIUS
.Is a certain
Quantity.Scale
able to control that, or would we need aLevelOfMeasurement
enum after all? https://en.wikipedia.org/wiki/Level_of_measurement#Mathematical_operations tells, that multiplication is only allowed on values atRATIO
level, so could e.g.RELATIVE
also be used to throw an exception for methods likeQuantity.multiply()
or do we have to get the level back in all relevant places?The text was updated successfully, but these errors were encountered: