Module Core_kernel.Float

type t = Core_kernel__.Import.float
include sig ... end
val typerep_of_t : t Typerep_lib.Std.Typerep.t
val typename_of_t : t Typerep_lib.Std.Typename.t
module Robust_compare : sig ... end

The results of robust comparisons on nan should be considered undefined.

include Robust_compare.S
val robust_comparison_tolerance : Core_kernel__.Import.float

intended to be a tolerance on human-entered floats

include Robustly_comparable.S with type t := Core_kernel__.Import.float
type t
val (>=.) : t ‑> t ‑> bool
val (<=.) : t ‑> t ‑> bool
val (=.) : t ‑> t ‑> bool
val (>.) : t ‑> t ‑> bool
val (<.) : t ‑> t ‑> bool
val (<>.) : t ‑> t ‑> bool
val robustly_compare : t ‑> t ‑> int
module O : sig ... end
module Terse : sig ... end
include module type of sig ... end with type t := t with module O := Base.Float.O with module Terse := Base.Float.Terse
type t = float
val of_float : float ‑> t
val to_float : t ‑> float
val t_of_sexp : Base__.Sexplib.Sexp.t ‑> t
val sexp_of_t : t ‑> Base__.Sexplib.Sexp.t
val of_string : string ‑> t
val to_string : t ‑> string
val (>=) : t ‑> t ‑> bool
val (<=) : t ‑> t ‑> bool
val (=) : t ‑> t ‑> bool
val (>) : t ‑> t ‑> bool
val (<) : t ‑> t ‑> bool
val (<>) : t ‑> t ‑> bool
val equal : t ‑> t ‑> bool
val compare : t ‑> t ‑> int
val min : t ‑> t ‑> t
val max : t ‑> t ‑> t
val ascending : t ‑> t ‑> int
val descending : t ‑> t ‑> int
val between : t ‑> low:t ‑> high:t ‑> bool
val clamp_exn : t ‑> min:t ‑> max:t ‑> t
val clamp : t ‑> min:t ‑> max:t ‑> t Base.Or_error.t
type comparator_witness = Base__Float.comparator_witness
val validate_lbound : min:t Base.Maybe_bound.t ‑> t Base.Validate.check
val validate_ubound : max:t Base.Maybe_bound.t ‑> t Base.Validate.check
val validate_bound : min:t Base.Maybe_bound.t ‑> max:t Base.Maybe_bound.t ‑> t Base.Validate.check
val pp : Caml.Format.formatter ‑> t ‑> unit
val validate_positive : t Base.Validate.check
val validate_non_negative : t Base.Validate.check
val validate_negative : t Base.Validate.check
val validate_non_positive : t Base.Validate.check
val is_positive : t ‑> bool
val is_non_negative : t ‑> bool
val is_negative : t ‑> bool
val is_non_positive : t ‑> bool
val validate_ordinary : t Base.Validate.check
val nan : t
val infinity : t
val neg_infinity : t
val max_value : t
val min_value : t
val zero : t
val one : t
val minus_one : t
val pi : t
val sqrt_pi : t
val sqrt_2pi : t
val euler : t
val epsilon_float : t
val max_finite_value : t
val min_positive_subnormal_value : t
val min_positive_normal_value : t
val to_int64_preserve_order : t ‑> int64 option
val to_int64_preserve_order_exn : t ‑> int64
val of_int64_preserve_order : int64 ‑> t
val one_ulp : [ `Down | `Up ] ‑> t ‑> t
val of_int : int ‑> t
val to_int : t ‑> int
val of_int64 : int64 ‑> t
val to_int64 : t ‑> int64
val round : ?dir:[ `Down | `Nearest | `Up | `Zero ] ‑> t ‑> t
val iround : ?dir:[ `Down | `Nearest | `Up | `Zero ] ‑> t ‑> int option
val iround_exn : ?dir:[ `Down | `Nearest | `Up | `Zero ] ‑> t ‑> int
val round_towards_zero : t ‑> t
val round_down : t ‑> t
val round_up : t ‑> t
val round_nearest : t ‑> t
val round_nearest_half_to_even : t ‑> t
val iround_towards_zero : t ‑> int option
val iround_down : t ‑> int option
val iround_up : t ‑> int option
val iround_nearest : t ‑> int option
val iround_towards_zero_exn : t ‑> int
val iround_down_exn : t ‑> int
val iround_up_exn : t ‑> int
val iround_nearest_exn : t ‑> int
val int63_round_down_exn : t ‑> Base.Int63.t
val int63_round_up_exn : t ‑> Base.Int63.t
val int63_round_nearest_exn : t ‑> Base.Int63.t
val iround_lbound : t
val iround_ubound : t
val is_nan : t ‑> bool
val is_inf : t ‑> bool
val min_inan : t ‑> t ‑> t
val max_inan : t ‑> t ‑> t
val (+) : t ‑> t ‑> t
val (-) : t ‑> t ‑> t
val (*) : t ‑> t ‑> t
val (/) : t ‑> t ‑> t
val (~-) : t ‑> t
val modf : t ‑> Parts.t
val mod_float : t ‑> t ‑> t
val add : t ‑> t ‑> t
val sub : t ‑> t ‑> t
val neg : t ‑> t
val scale : t ‑> t ‑> t
val abs : t ‑> t
module O = Base__Float.O
val to_string_round_trippable : t ‑> string
val to_string_hum : ?delimiter:char ‑> ?decimals:int ‑> ?strip_zero:bool ‑> t ‑> string
val to_padded_compact_string : t ‑> string
val int_pow : t ‑> int ‑> t
val ldexp : t ‑> int ‑> t
val frexp : t ‑> t * int
external log10 : t ‑> t =
external expm1 : t ‑> t =
external log1p : t ‑> t =
external copysign : t ‑> t ‑> t =
external cos : t ‑> t =
external sin : t ‑> t =
external tan : t ‑> t =
external acos : t ‑> t =
external asin : t ‑> t =
external atan : t ‑> t =
external atan2 : t ‑> t ‑> t =
external hypot : t ‑> t ‑> t =
external cosh : t ‑> t =
external sinh : t ‑> t =
external tanh : t ‑> t =
external sqrt : t ‑> t =
external exp : t ‑> t =
external log : t ‑> t =
val classify : t ‑> Class.t
val is_finite : t ‑> bool
val sign : t ‑> Base.Sign.t
val sign_exn : t ‑> Base.Sign.t
val sign_or_nan : t ‑> Sign_or_nan.t
val create_ieee : negative:bool ‑> exponent:int ‑> mantissa:Base.Int63.t ‑> t Base.Or_error.t
val create_ieee_exn : negative:bool ‑> exponent:int ‑> mantissa:Base.Int63.t ‑> t
val ieee_negative : t ‑> bool
val ieee_exponent : t ‑> int
val ieee_mantissa : t ‑> Base.Int63.t
include Identifiable.S with type t := t and type comparator_witness := comparator_witness
type t
include sig ... end
val t_of_sexp : Sexplib.Sexp.t ‑> t
val sexp_of_t : t ‑> Sexplib.Sexp.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (Core_kernel__.Import.int ‑> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_shape_t : Bin_prot.Shape.t
include Core_kernel__.Import.Stringable.S with type t := t
type t
val of_string : string ‑> t
val to_string : t ‑> string
include Comparable.S_binable with type t := t
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable_intf.S
include Base.Comparable_intf.Polymorphic_compare
include Base.Polymorphic_compare_intf.Infix
type t
val (>=) : t ‑> t ‑> bool
val (<=) : t ‑> t ‑> bool
val (=) : t ‑> t ‑> bool
val (>) : t ‑> t ‑> bool
val (<) : t ‑> t ‑> bool
val (<>) : t ‑> t ‑> bool
val equal : t ‑> t ‑> bool
val compare : t ‑> t ‑> int

-1 means "less than", 0 means "equal", 1 means "greater than", and other values should not be returned

val min : t ‑> t ‑> t
val max : t ‑> t ‑> t
val ascending : t ‑> t ‑> int

ascending is identical to compare. descending x y = ascending y x. These are intended to be mnemonic when used like List.sort ~cmp:ascending and List.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.

val descending : t ‑> t ‑> int
val between : t ‑> low:t ‑> high:t ‑> bool
val clamp_exn : t ‑> min:t ‑> max:t ‑> t

clamp_exn t ~min ~max returns t', the closest value to t such that between t' ~low:min ~high:max is true.

Raises if not (min <= max).

val clamp : t ‑> min:t ‑> max:t ‑> t Base.Or_error.t
include Base.Comparator.S with type t := t
type t
type comparator_witness
include Base.Comparable_intf.Validate with type t := t
type t
val validate_lbound : min:t Base.Maybe_bound.t ‑> t Base.Validate.check
val validate_ubound : max:t Base.Maybe_bound.t ‑> t Base.Validate.check
val validate_bound : min:t Base.Maybe_bound.t ‑> max:t Base.Maybe_bound.t ‑> t Base.Validate.check
include Hashable.S_binable with type t := t
type t
val hash : t ‑> Core_kernel__.Import.int
module Table : Hashable.Hashtbl.S_binable with type key = t
module Hash_set : Hash_set.S_binable with type elt = t
module Hash_queue : Hash_queue.S with type Key.t = t
include Core_kernel__.Import.Pretty_printer.S with type t := t
type t
val pp : Caml.Format.formatter ‑> t ‑> unit
include Quickcheckable.S with type t := t
type 'a gen
type 'a obs
type 'a shr
type t
val gen : t gen
val obs : t obs
val shrinker : t shr
val sign : t ‑> Sign.t
val robust_sign : t ‑> Sign.t

(Formerly sign) Uses robust comparison (so sufficiently small numbers are mapped to Zero). Also maps nan to Zero. Using this function is weakly discouraged.

val gen_uniform_excl : t ‑> t ‑> t Quickcheck.Generator.t

gen_uniform_excl lo hi creates a Quickcheck generator producing finite t values between lo and hi, exclusive. The generator approximates a uniform distribution over the interval (lo, hi). Raises an exception if lo is not finite, hi is not finite, or the requested range is empty.

The implementation chooses values uniformly distributed between 0 (inclusive) and 1 (exclusive) up to 52 bits of precision, then scales that interval to the requested range. Due to rounding errors and non-uniform floating point precision, the resulting distribution may not be precisely uniform and may not include all values between lo and hi.

val gen_incl : t ‑> t ‑> t Quickcheck.Generator.t

gen_incl lo hi creates a Quickcheck generator that produces values between lo and hi, inclusive, approximately uniformly distributed, with extra weight given to generating the endpoints lo and hi. Raises an exception if lo is not finite, hi is not finite, or the requested range is empty.

val gen_finite : t Quickcheck.Generator.t

gen_finite produces all finite t values, excluding infinities and all NaN values.

val gen_positive : t Quickcheck.Generator.t

gen_positive produces all (strictly) positive finite t values.

val gen_negative : t Quickcheck.Generator.t

gen_negative produces all (strictly) negative finite t values.

val gen_without_nan : t Quickcheck.Generator.t

gen_without_nan produces all finite and infinite t values, excluding all NaN values.