Open cstjean opened 2 years ago
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. https://github.com/PainterQubits/Unitful.jl/pull/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)
See also discussion in https://github.com/PainterQubits/Unitful.jl/issues/137
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
.