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
julia>5K -5°C
ERROR: AffineError: an invalid operation was attempted with affine quantities:5 K -5 °C
which is great because it's ambiguous, but
julia>10°C -5°C >2°C
false
This is clearly wrong for anyone who doesn't know about Unitful quirks, and it just bit one of my colleagues. In this case, 10°C - 5°C becomes 5K, which is considered less than 2°C because 2°C == 275 K.
Thus, Kelvin and °C comparisons should be an AffineError.
The text was updated successfully, but these errors were encountered:
One possible issue here is that there are times you would want to compare values in Kelvin and °C - for instance, if you've got a series of inputs to something in a mix of both, or simply if you've got values in both. It might actually be worth rethinking how affine units are thought of in general, actually - I would say that a difference between two affine values, say 200 K - 150 K, should probably not be comparable to an affine value on its own, but affine values in differing units, but the same dimension, should still be comparable, though I'm not sure if there's any good way to implement this.
I would say that a difference between two affine values, say 200 K - 150 K, should probably not be comparable to an affine value on its own,
I'm sympathetic to that, it's similar to the 4D matrix affine transformation in 3D rendering pipelines. #176 was my attempt as this, but it was superseded by Andrew's PR which didn't implement that distinction directly (but which is admittedly a lot more elegant than my PR)
Currently,
which is great because it's ambiguous, but
This is clearly wrong for anyone who doesn't know about Unitful quirks, and it just bit one of my colleagues. In this case,
10°C - 5°C
becomes5K
, which is considered less than 2°C because 2°C == 275 K.Thus, Kelvin and °C comparisons should be an
AffineError
.The text was updated successfully, but these errors were encountered: