package frama-c
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
NNicolas Bellec
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
VVincent Botbol
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
SSylvain Chiron
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
JJordan Ischard
-
MMaxime Jacquemin
-
BBenjamin Jorge
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
RRemi Lazarini
-
TTristan Le Gall
-
KKilyan Le Gallic
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
NNicky Mouha
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
CCécile Ruet-Cros
-
JJulien Signoles
-
FFabien Siron
-
NNicolas Stouls
-
HHugo Thievenaz
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=9c1cbffd28bb33c17a668107e39c96e4ae7378a3d8249f69b47afc7ee964e9b8
doc/frama-c.kernel/Frama_c_kernel/Floating_point/index.html
Module Frama_c_kernel.Floating_point
pretty modes
val set_float_display : float_display -> unitChange the printer mode for floats.
Rounding modes
val set_rounding_mode : rounding -> unitSet the current rounding mode.
val get_rounding_mode : unit -> roundingGet the current rounding mode.
val round_if_single_precision : fkind -> float -> floatRounds the given float to a single precision float if fkind = FFloat or fkind = FFloat32.
Floating-point operations
type truncated_to_integer = | Integer of Z.t(*The given float has been successfully truncated.
*)| Underflow(*The given float would underflow if truncated.
*)| Overflow(*The given float would overflow if truncated.
*)
val truncate_to_integer : float -> truncated_to_integerTruncates a given floating point number, i.e returns the closest integer rounded toward zero, regardless of the current rounding mode. The truncate_to_integer function converts the given number into an 64 bits integer it it fits or a token specifying if the conversion is impossible due to an underflow or an overflow.
Pretty printers
The function pretty_normal implements a custom printer. The function pretty relies on internal state float_display to decide between using the OCaml printer or the pretty_normal one. This mode can be changed using set_float_display.
val pretty_normal : use_hex:bool -> Format.formatter -> float -> unitval pretty : Format.formatter -> float -> unitval has_suffix : fkind -> string -> boolTrue if the given string's suffix corresponds to the given format, i.e "F" for single precision (or "F32" for _Float32), "D" (or "F64") for double precision (_Float64), and "L" for extended precision.
val extract_suffix : string -> (string * string * fkind) optionextract_suffix s tries to find a floating-point suffix ("f", "F", "d", "l", "f32", etc) in s and returns Some (s_without_suffix, suffix, fkind). If s has no suffix, returns Some (s, "", FDouble). If the suffix is unknown, returns None.
Format based constants
The significant size of a given format is denoted m. The exponent size of a given format is denoted e.
val largest_finite_float_of : format -> floatReturns the largest positive finite floating point number of a given format. It is computed as :
\left({2 - 2 ^ {1 - m}}\right) ^ {2 ^ {e - 1} - 1}val finite_range_of : format -> float * floatReturns the bounds of the finite range of a given format, i.e the largest negative finite floating point number and the largest positive finite floating point number of a given format.
val smallest_normal_float_of : format -> floatReturns the smallest positive normalized floating point number of a given format. It is computed as :
{2} ^ {2 - {2} ^ {e - 1}} val smallest_denormal_float_of : format -> floatReturns the smallest positive denormalized floating point number of a given format. It is simply computed by setting the least significant bit to one, as this bit corresponds to the last bit of the significant.
val unit_in_the_last_place_of : format -> floatReturns the unit in the last place of a given format, i.e the value of the least significant bit of a floating point number with an exponent set at zero. It is primally used to overapproximate rounding errors. It is computed as 2 ^ {-m}.
val minimal_exponent_of : format -> intval maximal_exponent_of : format -> int