Right now Unit assumes purely multiplicative conversions via scale_to_si. That works for most units (m ↔ cm, s ↔ ms, etc.), but fails for affine scales like Celsius and Fahrenheit, where conversion requires an offset (and, for °F, both offset and scale). This makes it impossible to represent absolute temperatures in °C/°F correctly, and it can lead to incorrect arithmetic if users try to “fake” it with only a scale.
Additionally, temperature differences (Δ°C, Δ°F) are multiplicative (no offset), whereas absolute temperatures (°C, °F) are affine. The library should distinguish the two to keep arithmetic valid.
Example:
(35 °C - 25 °C) = 10 °C = 10 K
Right now
Unitassumes purely multiplicative conversions via scale_to_si. That works for most units (m ↔ cm, s ↔ ms, etc.), but fails for affine scales like Celsius and Fahrenheit, where conversion requires an offset (and, for °F, both offset and scale). This makes it impossible to represent absolute temperatures in °C/°F correctly, and it can lead to incorrect arithmetic if users try to “fake” it with only a scale.Additionally, temperature differences (Δ°C, Δ°F) are multiplicative (no offset), whereas absolute temperatures (°C, °F) are affine. The library should distinguish the two to keep arithmetic valid.
Example: