From 8b79aec990617525cd26ef00d3faa18d37a0bce7 Mon Sep 17 00:00:00 2001 From: Ali Caglayan Date: Mon, 6 Feb 2023 00:43:25 +0100 Subject: [PATCH] add Float.min Signed-off-by: Ali Caglayan --- otherlibs/stdune/src/float.ml | 5 +++++ otherlibs/stdune/src/float.mli | 2 ++ 2 files changed, 7 insertions(+) diff --git a/otherlibs/stdune/src/float.ml b/otherlibs/stdune/src/float.ml index 62eb7e9a324..15dce2586e3 100644 --- a/otherlibs/stdune/src/float.ml +++ b/otherlibs/stdune/src/float.ml @@ -10,3 +10,8 @@ let max x y = match compare x y with | Eq | Gt -> x | Lt -> y + +let min x y = + match compare x y with + | Eq | Lt -> x + | Gt -> y diff --git a/otherlibs/stdune/src/float.mli b/otherlibs/stdune/src/float.mli index 3ebf0bf4055..3ca811cd30f 100644 --- a/otherlibs/stdune/src/float.mli +++ b/otherlibs/stdune/src/float.mli @@ -7,3 +7,5 @@ val to_string : t -> string val compare : t -> t -> Ordering.t val max : t -> t -> t + +val min : t -> t -> t