logo

Introducing Celsius and Fahrenheit Units

We routinely hear from our users: Swift Calcs supports such a wide range of units and functions...why not temperature? Temperature units are different, and including them in our calculation engine required a wholesale rewrite of many unit handling functions and solvers.

We are happy to announce that this work is now complete, and starting today, Celsius and Fahrenheit units are available for use in Swift Calcs.

What took so long?

Celsius and Fahrenheit are unlike any other unit in Swift Calcs because they have non-zero offsets. Converting any other unit is simply a matter of multiplying by the correct conversion constant:

4 in → 4 ⋅ (0.0254) → 0.1016 m

Not so with Celsius and Fahrenheit. These units do not share a zero, and therefore require both a multiplication AND an offset:

23 °F → (23 - 32) ⋅ (5/9) → -5 °C

The implications of this one little offset are enormous. What if instead of starting with 23 °F, we started with a difference?

(33 °F - 10 °F) → 23 °F → 23 ⋅ (5/9) → 12.78 °C

What happened to the offset? It cancelled out: since the offset is present in the conversion of 33 °F to °C and 10 °F to °C, the difference of these two values cancels the offset. The result is that in the first example, 23°F→-5°C, but in the second example 23°F→12.78°C. With temperature units, there is ambiguity when performing calculations.

Working through the Ambiguity

Dealing with this ambiguity in calculations, solvers, plots, and other functions is a challenge, and Swift Calcs has solved this problem through the use of intelligent assumptions when ambiguities arise that attempt to infer user intent, and through the availability of separate units for absolute and relative temperatures to allow the user to directly signal their intent.

Absolute temperature units are temperatures that include the offset in conversions, representing a true temperature on a thermometer. In the first example above, we would use the absolute temperature unit °F (entered as degF in Swift Calcs using the keyboard) and the conversion would therefore use the offset:

23 °F → -5 °C

Relative temperature units are differences between absolute temperatures, and represent a change in temperature. In the second example above, we would use the relative temperature units Δ°F (entered as deltaF in Swift Calcs using the keyboard) and the conversion would therefore ignore the offset:

23 Δ°F → 12.78 Δ°C

Learn More

We've produced a detailed write-up in our help area that dives in to using Celsius and Fahrenheit units in Swift Calcs, including the assumptions made by the calculation engine and how to override default behaviors. Find the article in our Help Center to learn more!

comments powered by Disqus