[back]

Fahrenheit to Celsius

Implement the function

val cels_of_fahr : float -> float

so that cels_of_fahr t is the Fahrenheit temperature t in Celsius. The behavior of the function is undefined if the input is not a valid temperature in Fahrenheit.

Examples

let is_close f1 f2 = Float.abs (f1 -.f2) < 10. ** (-15.)
let _ = assert (is_close (cels_of_fahr 32.) 0.)
let _ = assert (is_close (cels_of_fahr 100.) 37.7777777777777786)