How am I supposed to cast a float to an integer in OCaml?
I know how to get a float from an int, but there doesn't seem to be an easy way to get an int from a float.
# int_of_float ;;
- : float -> int = <fun>
I assume you want a nearby int
(this rounds towards zero, same as C does).
If you want the IEEE representation, see Int64.bits_of_float
.