AltErgoLib.Fpa_rounding
The rounding modes for the Floating Point Arithmetic theory. In the legacy frontend, the rounding mode type was `fpa_rounding_mode` and defined 5 rounding modes (see the rounding_mode
type below). The SMT2 standard defines the exact same rounding modes, but with different identifiers.
val compare_rounding_mode :
rounding_mode ->
rounding_mode ->
Ppx_deriving_runtime.int
Equal to "fpa_rounding_mode"
, the Alt-Ergo native rounding mode type.
val fpa_rounding_mode : Ty.t
The rounding mode type.
val rounding_mode_of_smt : string -> rounding_mode
Transforms the string corresponding to a RoundingMode element into the rounding_mode
equivalent. Raises 'Failure' if the string does not correspond to a valid rounding mode.
val rounding_mode_of_ae : string -> rounding_mode
Same, but for legacy's rounding_mode
equivalent.
val string_of_rounding_mode : rounding_mode -> string
Returns the string representation of the rounding_mode
(SMT2 standard)
val term_cst_of_rounding_mode : rounding_mode -> Dolmen.Std.Expr.term_cst
Returns the Dolmen constructor associated with the rounding mode.
val integer_log_2 : Numbers.Q.t -> int
Integer part of binary logarithm for NON-ZERO POSITIVE number *
val float_of_rational :
int ->
int ->
rounding_mode ->
Numbers.Q.t ->
Numbers.Q.t * Numbers.Z.t * int
float_of_rational prec exp mode x
float approx of a rational constant. The function also returns the mantissa and the exponent. i.e. if res, m, e = float_of_rational prec exp mode x
, then res = m * 2^e
*
val round_to_integer : rounding_mode -> Numbers.Q.t -> Numbers.Q.t
round_to_integer mode x
rounds the rational x
to an integer depending on the rounding mode mode