CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fenv.c
Go to the documentation of this file.
1/* FUNCTION: fegetround */
2
3#include <fenv.h>
4
6
7int fegetround(void)
8{
10 // CPROVER uses the x86 numbering of the rounding modes
11 return
12 #ifdef FE_DOWNWARD
14 #endif
17 #ifdef FE_UPWARD
19 #endif
20 -1;
21}
22
23/* FUNCTION: fesetround */
24
25#include <fenv.h>
26
27int fesetround(int rounding_mode)
28{
30 // CPROVER uses the x86 numbering of the rounding modes
32 #ifdef FE_DOWNWARD
33 rounding_mode==FE_DOWNWARD?1:
34 #endif
35 rounding_mode==FE_TONEAREST?0:
36 rounding_mode==FE_TOWARDZERO?3:
37 #ifdef FE_UPWARD
38 rounding_mode==FE_UPWARD?2:
39 #endif
40 0;
41 return 0; // we never fail
42}
43
44/* FUNCTION: feraiseexcept */
45
47{
49 __CPROVER_assert(excepts == 0, "floating-point exception");
50 return 0; // we never fail
51}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
void __CPROVER_assert(__CPROVER_bool assertion, const char *description)
int fesetround(int rounding_mode)
Definition fenv.c:27
int __CPROVER_rounding_mode
Definition math.c:1521
int feraiseexcept(int excepts)
Definition fenv.c:46
int fegetround(void)
Definition fenv.c:7