CBMC
fenv.c
Go to the documentation of this file.
1
/* FUNCTION: fegetround */
2
3
#include <fenv.h>
4
5
extern
int
__CPROVER_rounding_mode
;
6
7
int
fegetround
(
void
)
8
{
9
__CPROVER_HIDE:;
10
// CPROVER uses the x86 numbering of the rounding modes
11
return
12
#ifdef FE_DOWNWARD
13
__CPROVER_rounding_mode
==1?FE_DOWNWARD:
14
#endif
15
__CPROVER_rounding_mode
==0?FE_TONEAREST:
16
__CPROVER_rounding_mode
==3?FE_TOWARDZERO:
17
#ifdef FE_UPWARD
18
__CPROVER_rounding_mode
==2?FE_UPWARD:
19
#endif
20
-1;
21
}
22
23
/* FUNCTION: fesetround */
24
25
#include <fenv.h>
26
27
int
fesetround
(
int
rounding_mode)
28
{
29
__CPROVER_HIDE:;
30
// CPROVER uses the x86 numbering of the rounding modes
31
__CPROVER_rounding_mode
=
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
46
int
feraiseexcept
(
int
excepts)
47
{
48
__CPROVER_HIDE:;
49
__CPROVER_assert
(excepts == 0,
"floating-point exception"
);
50
return
0;
// we never fail
51
}
__CPROVER_assert
void __CPROVER_assert(__CPROVER_bool assertion, const char *description)
fesetround
int fesetround(int rounding_mode)
Definition:
fenv.c:27
__CPROVER_rounding_mode
int __CPROVER_rounding_mode
Definition:
x86_assembler.c:14
feraiseexcept
int feraiseexcept(int excepts)
Definition:
fenv.c:46
fegetround
int fegetround(void)
Definition:
fenv.c:7
src
ansi-c
library
fenv.c
Generated by
1.9.1