mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
Incorporating unit offsets into the internal "value" of the unit causes more problems than it solves. This commit ends that practice and instead only uses the offset when converting units or when computing the absolute value of a unit. Further, it makes it an error to compute the sign of a unit with an offset, since that is inherently ambiguous: there is no way to tell whether "-5 degC" is a temperature change, in which case it is definitely negative, or if it is a specific temperature of something, in which case it is "positive" in the sense of being above absolute zero. (Unclear how valuable this latter concept is anyway, given that there are no negative temperatures possible in that sense...) Adds several tests for the various problems the former practice caused, including all four basic arithmetic operations on units with offsets. Co-authored-by: Jos de Jong <wjosdejong@gmail.com>