module type S =sig..end
type t
typeouter =t
include Floatable.S
include Stringable.S
include Hashable.S_binable
include Comparable.S_binable
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.checkvalidate_ordinary fails if class is Nan or Infinite.val nan : tval infinity : tval neg_infinity : tval max_value : tval min_value : tval zero : tval epsilon : tval epsilon_float : tval max_finite_value : tval min_positive_value : tval of_int : int -> tval to_int : t -> intval of_int64 : int64 -> tval to_int64 : t -> int64val round : ?dir:[ `Down | `Nearest | `Up | `Zero ] -> t -> tval iround : ?dir:[ `Down | `Nearest | `Up | `Zero ] -> t -> int optionval iround_exn : ?dir:[ `Down | `Nearest | `Up | `Zero ] -> t -> intval round_towards_zero : t -> tval round_down : t -> tval round_up : t -> tval round_nearest : t -> tval iround_towards_zero : t -> int optionval iround_down : t -> int optionval iround_up : t -> int optionval iround_nearest : t -> int optionval iround_towards_zero_exn : t -> intval iround_down_exn : t -> intval iround_up_exn : t -> intval iround_nearest_exn : t -> intval is_nan : t -> boolval is_inf : t -> boolval min_inan : t -> t -> tnan. Returns
nan if both arguments are nan.val max_inan : t -> t -> tval (+) : t -> t -> tval (-) : t -> t -> tval ( * ) : t -> t -> tval (/) : t -> t -> tmodule Parts:sig..end
val modf : t -> Parts.tval mod_float : t -> t -> tmod_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 -> tval sub : t -> t -> tval neg : t -> tval scale : t -> t -> tval abs : t -> tval to_string_hum : ?delimiter:char -> ?decimals:int -> ?strip_zero:bool -> float -> stringto_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 -> tval frexp : t -> t * intmodule Class:sig..end
val classify : t -> Class.tval is_finite : t -> boolmodule Sign:sig..end
val sign : t -> Sign.tmodule Terse:sig..end
val outer_of_sexp : Sexplib.Sexp.t -> outerval sexp_of_outer : outer -> Sexplib.Sexp.tval bin_outer : outer Bin_prot.Type_class.tval bin_read_outer : outer Bin_prot.Read_ml.readerval bin_read_outer_ : outer Bin_prot.Unsafe_read_c.readerval bin_read_outer__ : (int -> outer) Bin_prot.Unsafe_read_c.readerval bin_reader_outer : outer Bin_prot.Type_class.readerval bin_size_outer : outer Bin_prot.Size.sizerval bin_write_outer : outer Bin_prot.Write_ml.writerval bin_write_outer_ : outer Bin_prot.Unsafe_write_c.writerval bin_writer_outer : outer Bin_prot.Type_class.writermax 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.