ItvUtils.FloatFloat - Floating-point arihmetics with rounding.
We rely on C code to provide functions with correct rounding (rounding direction and rounding precision).
type bit_float = {sign : bool;sign bit (true means negative)
*)fraction : Z.t;fraction bits
*)exponent : int;exponent (positive, with bias)
*)}Bit-representation of a float value.
Set the rounding mode globally. This affects the behaviors of all floating-point operations, including OCaml's native float operations, but excluding the operations in this module (and the float interval module) that specify a rounding direction.
Note that the operations with specified rounding directions may change the rounding direction globally in some unspecified way, and not reset it to its former value (this is done for efficiency).
val infinite : int -> tConstructs an infinity with the given sign. Zero maps to zero.
val is_nan : t -> boolval is_finite : t -> boolWhether x is finite or not (infinite or NaN).
val is_infinite : t -> boolval is_normal : t -> boolval is_denormal : t -> boolval sign : t -> intSign of x: -1 (negative), 0 (zero or NaN), or 1 (positive).
val sign_zero : t -> intAs sign, but zero is signed. Returns -1 (negative or -0), 0 (NaN), or 1 (positive of +0)
val is_zero : t -> boolval is_nonzero : t -> boolval is_positive : t -> boolval is_negative : t -> boolval is_positive_strict : t -> boolval is_negative_strict : t -> boolSign predicates.
val dfl_fmt : print_formatDefault format.
val hex_fmt : print_formatval to_string : print_format -> t -> stringval print : print_format -> out_channel -> t -> unitval fprint : print_format -> Format.formatter -> t -> unitval bprint : print_format -> Buffer.t -> t -> unitWe provide the classic operations (and more) for single and double precision and all four rounding directions.
module Single : sig ... endSingle precision operations.
module Double : sig ... endDouble precision operations.
Rounding direction.
val mantissa_bits : prec -> intval exponent_bits : prec -> intval exponent_bias : prec -> intval min_exponent : prec -> intval max_exponent : prec -> intval nan_infinity_exponent : prec -> intUseful constants.
Bit-level extraction.