module type S =sig
..end
type
t
typeouter =
t
include Floatable.S
include Identifiable.S
max
and min
will return nan if either argument is nan.
The validate_*
functions always fail if class is Nan
or Infinite
.
include Comparable.With_zero
include Robustly_comparable.S
nan
should be considered undefined.val validate_ordinary : t Validate.check
validate_ordinary
fails if class is Nan
or Infinite
.val nan : t
val infinity : t
val neg_infinity : t
val max_value : t
val min_value : t
val zero : t
val epsilon : t
val epsilon_float : t
val max_finite_value : t
val min_positive_value : 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 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 is_nan : t -> bool
val is_inf : t -> bool
val min_inan : t -> t -> t
nan
. Returns
nan
if both arguments are nan
.val max_inan : t -> t -> t
val (+) : t -> t -> t
val (-) : t -> t -> t
val ( * ) : t -> t -> t
val (/) : t -> t -> t
module Parts:sig
..end
val modf : t -> Parts.t
val mod_float : t -> t -> t
mod_float x y
returns a result with the same sign as x
. It returns nan
if y
is 0
. It is basically
let mod_float x y = x -. float(truncate(x/.y)) *. y
not
let mod_float x y = x -. floor(x/.y) *. y
and therefore resembles mod
on integers more than %
.val add : t -> t -> t
val sub : t -> t -> t
val neg : t -> t
val scale : t -> t -> t
val abs : t -> t
val to_string_hum : ?delimiter:char -> ?decimals:int -> ?strip_zero:bool -> float -> string
to_string_hum ~decimals:3 1234.1999 = "1_234.200"
to_string_hum ~decimals:3 ~strip_zero:true 1234.1999 = "1_234.2"
. No delimiters
are inserted to the right of the decimal.val ldexp : t -> int -> t
val frexp : t -> t * int
module Class:sig
..end
val classify : t -> Class.t
val is_finite : t -> bool
module Sign:sig
..end
val sign : t -> Sign.t
module Terse:sig
..end
val outer_of_sexp : Sexplib.Sexp.t -> outer
val sexp_of_outer : outer -> Sexplib.Sexp.t
val bin_outer : outer Bin_prot.Type_class.t
val bin_read_outer : outer Bin_prot.Read_ml.reader
val bin_read_outer_ : outer Bin_prot.Unsafe_read_c.reader
val bin_read_outer__ : (int -> outer) Bin_prot.Unsafe_read_c.reader
val bin_reader_outer : outer Bin_prot.Type_class.reader
val bin_size_outer : outer Bin_prot.Size.sizer
val bin_write_outer : outer Bin_prot.Write_ml.writer
val bin_write_outer_ : outer Bin_prot.Unsafe_write_c.writer
val bin_writer_outer : outer Bin_prot.Type_class.writer
max
and min
will return nan if either argument is nan.
The validate_*
functions always fail if class is Nan
or Infinite
.
The results of robust comparisons on nan
should be considered undefined.
validate_ordinary
fails if class is Nan
or Infinite
.
includes positive and negative Float.infinity
min and max that return the other value if one of the values is a nan
. Returns
nan
if both arguments are nan
.
Returns the fractional part and the whole (i.e. integer) part. For example, modf
(-3.14)
returns { fractional = -0.14; integral = -3.; }
!
mod_float x y
returns a result with the same sign as x
. It returns nan
if y
is 0
. It is basically
let mod_float x y = x -. float(truncate(x/.y)) *. y
not
let mod_float x y = x -. floor(x/.y) *. y
and therefore resembles mod
on integers more than %
.
Pretty print float, for example to_string_hum ~decimals:3 1234.1999 = "1_234.200"
to_string_hum ~decimals:3 ~strip_zero:true 1234.1999 = "1_234.2"
. No delimiters
are inserted to the right of the decimal.