module Float_intf: Float_intf
module Binable: Binable0
module type S =sig
..end
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
.
min_positive_subnormal_value = 2 ** -1074
min_positive_normal_value = 2 ** -1022
If f <= iround_lbound || f >= iround_ubound
, then iround*
functions will refuse
to round f
, returning None
or raising as appropriate.
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 %
.
A sub-module designed to be opened to make working with floats more convenient.
Like to_string
, but guaranteed to be round-trippable.
It usually yields as few significant digits as possible. That is, it won't print
3.14
as 3.1400000000000001243
. The only exception is that occasionally it will
output 17 significant digits when the number can be represented with just 16 (but
not 15 or less) of them.
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.