package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_utils/Mopsa_utils/ItvUtils/Float/index.html
Module ItvUtils.Float
Float - Floating-point arihmetics with rounding.
We rely on C code to provide functions with correct rounding (rounding direction and rounding precision).
Types
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.
Global rounding direction
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).
Operations without rounding
val infinite : int -> tConstructs an infinity with the given sign. Zero maps to zero.
Predicates
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.
Printing
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 -> unitOperations with specific rounding direction and precision
We 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.
Operations with rounding mode as argument
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.