Module Float_intf

module Float_intf: sig .. end
Floating-point representation and utilities.


Floating-point representation and utilities.
module Binable: Binable0
module type S = sig .. end

Floating-point representation and utilities.

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.