Float_u.OptionSourceinclude Ppx_quickcheck_runtime.Quickcheckable.S with type t := tinclude Sexplib0.Sexpable.S__stack with type t := tinclude Sexplib0.Sexpable.Of_sexp with type t := tinclude Sexplib0.Sexpable.Sexp_of__stack with type t := tinclude Typerep_lib.Typerepable.S with type t := tinclude Core.Bin_prot.Binable.S__local with type t := tinclude Bin_prot.Binable.S_only_functions__local with type t := tinclude sig ... endThis function only needs implementation if t exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t afterwards.
A workaround for the lack of unboxed float literals; strictly speaking one can use it for non constants but the name is a helpful reminder.
first_some x y returns x if x is not none, else returns y
some_or t ~default = first_some t (unchecked_some t)
val divide_if_denominator_nonzero_else :
numerator:t ->
denominator:t ->
else_:t ->
t
[@@zero_alloc]Computes numerator / denominator when denominator is nonzero, otherwise returns else_. This is done without allocating or branching by using Unboxed.select.
clamp_exn t ~min ~max clamps t to the range [min, max]. A none bound does not clamp on that side. Returns none if t is none.
Returns false if t is none
include module type of OOperations where we use NaN semantics even though they are inconsistent with the remaining operators, e.g., >= violates the equivalance a >= b <-> a > b || a = b because it returns false for two none inputs.