Next: , Up: Nonlinear Unit Conversions   [Contents][Index]


6.1 Temperature Conversions

Conversions between temperatures are different from linear conversions between temperature increments—see the example below. The absolute temperature conversions are handled by units starting with ‘temp’, and you must use functional notation. The temperature-increment conversions are done using units starting with ‘deg’ and they do not require functional notation.

You have: tempF(45)
You want: tempC
        7.2222222

You have: 45 degF
You want: degC
        * 25
        / 0.04

Think of ‘tempF(x)’ not as a function but as a notation that indicates that x should have units of ‘tempF’ attached to it. See Defining Nonlinear Units. The first conversion shows that if it’s 45 degrees Fahrenheit outside, it’s 7.2 degrees Celsius. The second conversion indicates that a change of 45 degrees Fahrenheit corresponds to a change of 25 degrees Celsius. The conversion from ‘tempF(x)’ is to absolute temperature, so that

You have: tempF(45)
You want: degR
        * 504.67
        / 0.0019814929

gives the same result as

You have: tempF(45)
You want: tempR
        * 504.67
        / 0.0019814929

But if you convert ‘tempF(x)’ to ‘degC’, the output is probably not what you expect:

You have: tempF(45)
You want: degC
        * 280.37222
        / 0.0035666871

The result is the temperature in K, because ‘degC’ is defined as ‘K’, the kelvin. For consistent results, use the ‘tempX’ units when converting to a temperature rather than converting a temperature increment.

The ‘tempC()’ and ‘tempF()’ definitions are limited to positive absolute temperatures, and giving a value that would result in a negative absolute temperature generates an error message:

You have: tempC(-275)
                    ^
Argument of function outside domain

Next: US Consumer Price Index, Up: Nonlinear Unit Conversions   [Contents][Index]