On this page:
celsius
fahrenheit
get-kelvin
get-rankine
get-celsius
get-fahrenheit
6.3.90.900

4 Temperatures

 (require typed/measures-with-dimensions/temperature)
  package: measures-with-dimensions
Celsius and Fahrenheit temperatures are not represented as measures, but temperatures in an absolute temperature scale such as kelvin or rankine are.
So instead, celsius and fahrenheit are functions that take numbers and convert them to an absolute temperature scale like kelvin or rankine, and functions like get-celsius and get-fahrenheit take measures and produce the corrosponding temperature in celsius or fahrenheit, represented as a number.

procedure

(celsius n)  Absolute-Temperature

  n : Real
Takes a temperature in celsius, represented as a number, and produces a measure representing the corrosponding temperature in kelvin.

Examples:
> (require typed/racket)
> (require typed/measures-with-dimensions)
> (celsius 0.0)

- : Absolute-Temperature

(m: 273.15 kelvin)

> (celsius 100.0)

- : Absolute-Temperature

(m: 373.15 kelvin)

> (celsius -273.15)

- : Absolute-Temperature

(m: 0.0 kelvin)

procedure

(fahrenheit n)  Absolute-Temperature

  n : Real
Takes a temperature in fahrenheit (represented as a number), and produces a measure representing the corrosponding temperature in rankine. (Rankine is an absolute temperature scale where 0 is at absolute zero, but the size of one degree is the same as the size of one fahrenheit degree)

Examples:
> (require typed/racket)
> (require typed/measures-with-dimensions)
> (fahrenheit 32.0)

- : Absolute-Temperature

(m: 491.67 rankine)

> (fahrenheit 212.0)

- : Absolute-Temperature

(m: 671.6700000000001 rankine)

> (fahrenheit 0.0)

- : Absolute-Temperature

(m: 459.67 rankine)

> (fahrenheit -459.67)

- : Absolute-Temperature

(m: 0.0 rankine)

procedure

(get-kelvin m)  Nonnegative-Real

  m : Absolute-Temperature
Takes a measure and produces the corrosponding temperature in kelvin, represented as a number.

Examples:
> (require typed/racket)
> (require typed/measures-with-dimensions)
> (get-kelvin (make-measure 300 kelvin))

- : Real [more precisely: Nonnegative-Real]

300

> (get-kelvin (celsius 0.0))

- : Real [more precisely: Nonnegative-Real]

273.15

> (get-kelvin (celsius 100.0))

- : Real [more precisely: Nonnegative-Real]

373.15

> (get-kelvin (fahrenheit 32.0))

- : Real [more precisely: Nonnegative-Real]

273.15000000000003

Takes a measure and produces the corrosponding temperature in rankines, represented as a number.

Examples:
> (require typed/racket)
> (require typed/measures-with-dimensions)
> (get-rankine (make-measure 500 rankine))

- : Real [more precisely: Nonnegative-Real]

500

> (get-rankine (celsius 0.0))

- : Real [more precisely: Nonnegative-Real]

491.66999999999996

> (get-rankine (fahrenheit 32.0))

- : Real [more precisely: Nonnegative-Real]

491.67

> (get-rankine (fahrenheit 212.0))

- : Real [more precisely: Nonnegative-Real]

671.6700000000001

procedure

(get-celsius m)  Real

  m : Absolute-Temperature
Takes a measure and produces the corrosponding temperature in celsius, represented as a number.

Examples:
> (require typed/racket)
> (require typed/measures-with-dimensions)
> (get-celsius (make-measure 273.15 kelvin))

- : Real

0.0

> (get-celsius (celsius 0))

- : Real

0

> (get-celsius (fahrenheit 32))

- : Real

0

> (get-celsius (fahrenheit 212))

- : Real

100

procedure

(get-fahrenheit m)  Real

  m : Absolute-Temperature
Takes a measure and produces the corrosponding temperature in fahrenheit, represented as a number.

Examples:
> (require typed/racket)
> (require typed/measures-with-dimensions)
> (get-fahrenheit (make-measure 273.15 kelvin))

- : Real

31.999999999999943

> (get-fahrenheit (fahrenheit 32))

- : Real

32

> (get-fahrenheit (celsius 0))

- : Real

32

> (get-fahrenheit (celsius 100))

- : Real

212