Interval Mapping - ocaml

How to map a value, from an interval, to another one

let ab = (10, 100)
let cd = (20, 2000)
let e = (11)

let interv_map ab cd (e) =
  let a, b = (ab) in
  let c, d = (cd) in
  let ab_diff = (b - a) in
  let cd_diff = (d - c) in
  let f = (e - a) in
  ((f * cd_diff) + c) / ab_diff

let () =
  let r = interv_map ab cd (e) in
  Printf.printf "interv. map'd: %d\n" r;
;;

Get the result with:

\ocaml interv.ml

Result:

interv. map'd: 22

The equivalent with floats:
intervf.ml