Open maroneze opened 3 years ago
A few points:
double
) [very minor, though]float
. This seems consistent with the macros from math.h
, but raises the question of having \plus_infinity_double
and so on.\is_plus_infinity
, \is_minus_infinity
and \is_NaN
already exist, both for double
and float
?Indeed, I couldn't find yet an example where ensures \result == \plus_infinity
could not be replaced with ensures \is_plus_infinity(\result)
, or something similar (assuming the plugins handle this case precisely).
I think the only case where these constants seem necessary is when trying to use INFINITY
/NAN
in logic functions, e.g.:
logic float _infinity(ℤ x) = \plus_infinity;
logic float _nan(ℤ x) = \NaN;
With definitions such as the above, it is possible to use the same macros for INFINITY
/NAN
in logic functions as well as in other specifications, assuming the underlying C library (e.g. Frama-C's) uses a compatible definition for the macro.
Constants such as
\plus_infinity
,\minus_infinity
and\NaN
would be useful to have in ACSL.Currently, specifications dealing with non-finite floating-point values must resort to using expressions such as
1.0f/0.0
or0.0f/0.0
, or they need to includemath.h
and rely on C99 macros such asINFINITY
andNAN
. The specifications become much less clear and may induce unnecessary dependency on libc headers.