CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
float.c
Go to the documentation of this file.
1/* FUNCTION: _controlfp */
2
3#ifdef _WIN32
4#include <float.h>
5
7
8unsigned int _controlfp(
9 unsigned int new_value,
10 unsigned int mask)
11{
13 (__CPROVER_fpu_control_word&~mask)|new_value;
14
15 if((mask&_MCW_RC)!=0)
16 __CPROVER_rounding_mode=(new_value&_MCW_RC)>>8;
17
19}
20
21#endif
22
23/* FUNCTION: _status87 */
24
25#ifdef _WIN32
26
28
29unsigned int _status87(void)
30{
32}
33
34#endif
35
36/* FUNCTION: _statusfp */
37
38#ifdef _WIN32
39
41
42unsigned int _statusfp(void)
43{
45}
46
47#endif
48
49/* FUNCTION: _statusfp2 */
50
51#ifdef _WIN32
52
54
55void _statusfp2(unsigned int *px86, unsigned int *pSSE2)
56{
57 unsigned SSE2_status;
59 *pSSE2=SSE2_status; // nondet
60}
61
62#endif
63
64/* FUNCTION: _isnan */
65
66int _isnan(double x)
67{
68 return __CPROVER_isnand(x);
69}
70
71/* FUNCTION: __builtin_flt_rounds */
72
74
76{
77 // This is a clang builtin for FLT_ROUNDS
78 // The magic numbers are C99 and different from the
79 // x86 encoding that CPROVER uses.
80 return __CPROVER_rounding_mode==0?1: // to nearest
81 __CPROVER_rounding_mode==1?3: // downward
82 __CPROVER_rounding_mode==2?2: // upward
83 __CPROVER_rounding_mode==3?0: // to zero
84 -1;
85}
86
87/* FUNCTION: __flt_rounds */
88
89int __builtin_flt_rounds(void);
90
91int __flt_rounds(void)
92{
93 // Spotted on FreeBSD
94 return __builtin_flt_rounds();
95}
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
__CPROVER_bool __CPROVER_isnand(double f)
int _isnan(double x)
Definition float.c:66
int __builtin_flt_rounds(void)
Definition float.c:75
int __flt_rounds(void)
Definition float.c:91
int __CPROVER_rounding_mode