mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
test(float): add some tests for FP min/max
This commit is contained in:
parent
841dac234a
commit
8060980266
1 changed files with 14 additions and 0 deletions
|
|
@ -58,6 +58,20 @@ let max (x : t) y =
|
||||||
| _, FP_nan -> x
|
| _, FP_nan -> x
|
||||||
| _ -> if x > y then x else y
|
| _ -> 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 equal (a:float) b = a=b
|
||||||
|
|
||||||
let hash : t -> int = Hashtbl.hash
|
let hash : t -> int = Hashtbl.hash
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue