Closed gilles-gosuin closed 3 years ago
When adding 2 quantities of Celsius the library needs to know how to interpret these: Quantities can be of scale RELATIVE
or ABSOLUTE
, while if not explicitly specified the default is ABSOLUTE
.
See these tests for the various combinations, and in particular the test addingRelativeTemperatures
, which maps onto your usecase:
https://github.com/unitsofmeasurement/indriya/blob/master/src/test/java/tech/units/indriya/quantity/TemperatureTest.java
(So in your case you likely want to declare both q1 and q2 with scale RELATIVE
.)
Feel free to close this issue, if you think your question is sufficiently answered.
Thanks for this quick reply!
As the API documentation mentions, this is hugely unintuitive. So much so that I actually didn't bother reading it (and definitely should have).
It may seem unintuitive, but it's thermodynamically correct, also see https://physics.stackexchange.com/questions/132720/how-do-you-add-temperatures or https://reference.wolfram.com/language/tutorial/TemperatureUnits.html or the JavaDoc of Quantity.
I'm not sure I understand correctly what I just discovered, maybe you can help me...
The following test:
fails with:
My environment:
Please find attached the fully functional Gradle project containing this test case, for your convenience: indryia-bug-report.zip