1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
module ValueHash = Hashtbl.Make(struct
  type t = Ast.value

  let equal a b =
    match a, b with
    | Ast.VFloat fa, Ast.VFloat fb when Float.is_nan fa && Float.is_nan fb -> true
    | _ -> a = b

  let hash v =
    match v with
    | Ast.VFloat f when Float.is_nan f -> Hashtbl.hash "nan"
    | _ -> Hashtbl.hash v
end)