From 8ed03f4bea7134fcde38d5c8582b88bbbaf6a7ee Mon Sep 17 00:00:00 2001
From: Julien Signoles <julien.signoles@cea.fr>
Date: Tue, 27 Aug 2019 15:57:41 +0200
Subject: [PATCH] add Transitioning.Float.max_float

---
 Makefile.generating                      | 13 +++++++++++++
 src/libraries/stdlib/transitioning.ml.in |  4 ++++
 src/libraries/stdlib/transitioning.mli   |  5 +++++
 3 files changed, 22 insertions(+)

diff --git a/Makefile.generating b/Makefile.generating
index 12dd18b3f0a..31a445a75ca 100644
--- a/Makefile.generating
+++ b/Makefile.generating
@@ -133,11 +133,23 @@ ifeq ($(HAS_OCAML408),yes)
         Format.String_tag str -> str \
       | _ -> raise (Invalid_argument "unsupported tag extension")
   FORMAT_STAG_OF_STRING=Format.String_tag s
+  HAS_OCAML407_OR_408=yes
 else
   DYNLINK_INIT=Dynlink.init
   FORMAT_STAG=tag
   FORMAT_STRING_OF_STAG=s
   FORMAT_STAG_OF_STRING=s
+  ifeq ($(HAS_OCAML407),yes)
+    HAS_OCAML407_OR_408=yes
+  else
+    HAS_OCAML407_OR_408=no
+  endif
+endif
+
+ifeq ($(HAS_OCAML407_OR_408),yes)
+  FLOAT_MAX_FLOAT=Float.max_float
+else
+  FLOAT_MAX_FLOAT=Pervasives.max_float
 endif
 
 src/libraries/stdlib/transitioning.ml: \
@@ -153,6 +165,7 @@ src/libraries/stdlib/transitioning.ml: \
          -e 's/@ASSOC_OPT@/$(ASSOC_OPT)/g' \
          -e 's/@ASSQ_OPT@/$(ASSQ_OPT)/g' \
          -e 's/@DYNLINK_INIT@/$(DYNLINK_INIT)/g' \
+         -e 's/@FLOAT_MAX_FLOAT@/$(FLOAT_MAX_FLOAT)/g' \
          -e 's/@FORMAT_STAG@/$(FORMAT_STAG)/g' \
          -e 's/@FORMAT_STRING_OF_STAG@/$(FORMAT_STRING_OF_STAG)/g' \
          -e 's/@FORMAT_STAG_OF_STRING@/$(FORMAT_STAG_OF_STRING)/g' \
diff --git a/src/libraries/stdlib/transitioning.ml.in b/src/libraries/stdlib/transitioning.ml.in
index de6215991de..cf09ddd667e 100644
--- a/src/libraries/stdlib/transitioning.ml.in
+++ b/src/libraries/stdlib/transitioning.ml.in
@@ -37,6 +37,10 @@ module Dynlink = struct
   let init = @DYNLINK_INIT@
 end
 
+module Float = struct
+  let max_float = @FLOAT_MAX_FLOAT@
+end
+
 module Format = struct
   type stag = Format.@FORMAT_STAG@
   let string_of_stag s = @FORMAT_STRING_OF_STAG@
diff --git a/src/libraries/stdlib/transitioning.mli b/src/libraries/stdlib/transitioning.mli
index 521cf30c013..94ae54311a9 100644
--- a/src/libraries/stdlib/transitioning.mli
+++ b/src/libraries/stdlib/transitioning.mli
@@ -49,6 +49,11 @@ module Dynlink: sig
   val init: unit -> unit
 end
 
+(** 4.07 *)
+module Float: sig
+  val max_float: float
+end
+
 (** 4.08 *)
 module Format: sig
   type stag
-- 
GitLab