From 9d083df3a60cd50cd9d45b14f4c90788901f057d Mon Sep 17 00:00:00 2001 From: Fardale Date: Sat, 18 Jan 2020 16:16:52 +0100 Subject: [PATCH] feat(CCInt): add of_float --- src/core/CCInt.ml | 6 ++++++ src/core/CCInt.mli | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/core/CCInt.ml b/src/core/CCInt.ml index bd8b7140..cd34c71b 100644 --- a/src/core/CCInt.ml +++ b/src/core/CCInt.ml @@ -211,6 +211,12 @@ let of_string s = let of_string_exn = Stdlib.int_of_string +let of_float = int_of_float + +(*$= + 1 (of_float 1.2) +*) + type output = char -> unit (* abstract printer *) diff --git a/src/core/CCInt.mli b/src/core/CCInt.mli index 0a515611..6156aab0 100644 --- a/src/core/CCInt.mli +++ b/src/core/CCInt.mli @@ -58,6 +58,9 @@ val of_string_exn : string -> t @raise Failure in case of failure. @since NEXT_RELEASE *) +val of_float : float -> t +(** @since NEXT_RELEASE *) + val pp_binary : t printer (** Print as "0b00101010". @since 0.20 *)