test(float): add some tests for FP min/max

This commit is contained in:
Simon Cruanes 2018-05-14 18:09:39 -05:00
parent 841dac234a
commit 8060980266

View file

@ -58,6 +58,20 @@ let max (x : t) y =
| _, FP_nan -> x
| _ -> if x > y then x else y
(*$T
max nan 1. = 1.
min nan 1. = 1.
max 1. nan = 1.
min 1. nan = 1.
*)
(*$Q
Q.(pair float float) (fun (x,y) -> \
is_nan x || is_nan y || (min x y <= x && min x y <= y))
Q.(pair float float) (fun (x,y) -> \
is_nan x || is_nan y || (max x y >= x && max x y >= y))
*)
let equal (a:float) b = a=b
let hash : t -> int = Hashtbl.hash