Module Utils.Float
Float implementation.
- since
- 2.0
include Comparable with type t = float
val compare : t -> t -> int
Comparison over
t
.compare x y
returns0
iffequal x y = 0
. Ifx
andy
are not equal, it returns a negative integer iffx
is lesser thany
and a positive integer otherwise.
val hash : t -> int
A hash function over
t
.
val set_precision : float -> unit
Set the precision of
equal
andcompare
for float. If the precision isp
, then the floatsx
andy
are equal iffabs(x-y) < p
. By default, the precision is1e-8
(that is 0.864 milliseconds if floats represent days).
val round : t -> int
Round a float to the nearest integer.