Module Float_u.OptionSource

Sourcetype t : float64 mod everything
Sourceval globalize : t @ local -> t
include Ppx_quickcheck_runtime.Quickcheckable.S with type t := t
Sourceval quickcheck_generator : t Base_quickcheck.Generator.t
Sourceval quickcheck_observer : t Base_quickcheck.Observer.t
Sourceval quickcheck_shrinker : t Base_quickcheck.Shrinker.t
include Sexplib0.Sexpable.S__stack with type t := t
include Sexplib0.Sexpable.Of_sexp with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
include Sexplib0.Sexpable.Sexp_of__stack with type t := t
include Typerep_lib.Typerepable.S with type t := t
include Core.Bin_prot.Binable.S__local with type t := t
include Bin_prot.Binable.S_only_functions__local with type t := t
include sig ... end
Sourceval bin_size_t : t Bin_prot.Size.sizer
Sourceval bin_write_t : t Bin_prot.Write.writer
Sourceval bin_read_t : t Bin_prot.Read.reader
Sourceval __bin_read_t__ : t Bin_prot.Read.vtag_reader

This 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.

Sourceval bin_shape_t : Bin_prot.Shape.t
include Ppx_hash_lib.Hashable.S with type t := t
include Core.Immediate_option.S_unboxed_float64 with type t := t with type value := float#
Sourceval sexp_of_t : t -> Core.Sexp.t
Sourceval some_is_representable : float# @ local -> Base.Bool.t [@@zero_alloc]
Sourceval is_none : t @ local -> Base.Bool.t [@@zero_alloc]
Sourceval unchecked_value : t -> float# [@@zero_alloc]
Sourcemodule Optional_syntax : sig ... end
Sourceval unsafe_value : t -> float#
Sourceval to_string : t -> string
Sourceval none : t
Sourceval is_some : t -> bool [@@zero_alloc]
Sourceval some : float# -> t [@@zero_alloc]
Sourceval unchecked_some : float# -> t [@@zero_alloc]
Sourceval of_float_nan_as_none : float# -> t [@@zero_alloc strict]
Sourceval to_float_none_as_nan : t -> float# [@@zero_alloc]
Sourceval zero : t
Sourceval one : t
Sourceval scale : t -> float# -> t [@@zero_alloc]
Sourceval div : t -> float# -> t [@@zero_alloc]
Sourceval equal : t -> t -> bool [@@zero_alloc]
Sourceval of_option : float option -> t [@@zero_alloc]
Sourceval to_option : t -> float option
Sourceval of_or_null : float or_null -> t [@@zero_alloc]
Sourceval to_or_null : t -> float or_null
Sourceval select : bool -> t -> t -> t [@@zero_alloc]
Sourceval some_if : bool -> float# -> t [@@zero_alloc]
Sourceval const : float -> t [@@zero_alloc]

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.

Sourceval first_some : t -> t -> t [@@zero_alloc]

first_some x y returns x if x is not none, else returns y

Sourceval some_or : t -> default:float# -> t [@@zero_alloc]

some_or t ~default = first_some t (unchecked_some t)

Sourceval merge : t -> t -> f:(float# -> float# -> float#) -> t
Sourceval 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.

Sourceval value : t -> default:float# -> float# [@@zero_alloc]
Sourceval value_exn : t -> float# [@@zero_alloc]
Sourceval compare : t -> t -> int [@@zero_alloc]
Sourceval clamp_exn : t -> min:t -> max:t -> t

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

Sourceval is_finite : t -> bool [@@zero_alloc]
Sourceval is_inf : t -> bool [@@zero_alloc]
Sourceval is_positive : t -> bool [@@zero_alloc]
Sourceval is_non_negative : t -> bool [@@zero_alloc]
Sourceval is_negative : t -> bool [@@zero_alloc]
Sourceval is_non_positive : t -> bool [@@zero_alloc]
Sourceval is_integer : t -> bool [@@zero_alloc]
Sourcemodule O : sig ... end
include module type of O
Sourceval (+) : t -> t -> t [@@zero_alloc]
Sourceval (-) : t -> t -> t [@@zero_alloc]
Sourceval (*) : t -> t -> t [@@zero_alloc]
Sourceval (/) : t -> t -> t [@@zero_alloc]
Sourceval (**) : t -> t -> t [@@zero_alloc]
Sourceval (=) : t -> t -> bool [@@zero_alloc]
Sourceval (<>) : t -> t -> bool [@@zero_alloc]
Sourceval abs : t -> t [@@zero_alloc]
Sourceval neg : t -> t [@@zero_alloc]
Sourceval min : t -> t -> t [@@zero_alloc]

The result of min will be none if either operand is.

Sourceval max : t -> t -> t [@@zero_alloc]

The result of max will be none if either operand is. (Note that this disagrees with compare, which thinks none is less than all other values!)

Sourcemodule Ieee_nan : sig ... end

Operations 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.

Sourcemodule Ref : sig ... end
Sourcemodule Stable : sig ... end