Module Framac_ival.Floating_point
Floating-point operations.
type c_rounding_mode = | FE_ToNearest| FE_Upward| FE_Downward| FE_TowardZero
Rounding modes defined in the C99 standard.
val set_round_downward : unit -> unitval set_round_upward : unit -> unitval set_round_nearest_even : unit -> unitval set_round_toward_zero : unit -> unitval round_to_single_precision_float : float -> floatval max_single_precision_float : floatval most_negative_single_precision_float : floatval neg_min_denormal : floatval min_single_precision_denormal : floatval neg_min_single_precision_denormal : floatval sys_single_precision_of_string : string -> floattype parsed_float = {f_nearest : float;f_lower : float;f_upper : float;
}If s is parsed as (n, l, u), then n is the nearest approximation of s with the desired precision. Moreover, l and u are the most precise float such that l <= s <= u, again with this precision.
Consistent with logic_real definition in Cil_types.
parse s parses s and returns the parsed float and its kind (single, double or long double precision) according to its suffix, if any. Strings with no suffix are parsed as double.
val pretty_normal : use_hex:bool -> Stdlib.Format.formatter -> float -> unitval pretty : Stdlib.Format.formatter -> float -> unitexception Float_Non_representable_as_Int64 of signval truncate_to_integer : float -> Z.tRaises Float_Non_representable_as_Int64 if the float value cannot be represented as an Int64 or as an unsigned Int64.
val bits_of_max_double : Z.tbinary representation of -DBL_MAX and DBL_MAX as 64 bits signed integers
val bits_of_most_negative_double : Z.tval bits_of_max_float : Z.tbinary representation of -FLT_MAX and FLT_MAX as 32 bits signed integers
val bits_of_most_negative_float : Z.tval fround : float -> floatRounds to nearest integer, away from zero (like round() in C).
val trunc : float -> floatRounds to integer, toward zero (like trunc() in C).
Single-precision (32-bit) floating-point wrappers
val expf : float -> floatval logf : float -> floatval log10f : float -> floatval powf : float -> float -> floatval sqrtf : float -> floatval fmodf : float -> float -> floatval cosf : float -> floatval sinf : float -> floatval atan2f : float -> float -> floatAuxiliary functions similar to the ones in the C math library
val isnan : float -> boolval isfinite : float -> boolval nextafter : float -> float -> floatval nextafterf : float -> float -> float