File tree 4 files changed +60
-2
lines changed
regression/cbmc/Float-div1-refine
4 files changed +60
-2
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <math.h>
3
+
4
+ #ifdef __GNUC__
5
+ void inductiveStepHunt (float startState )
6
+ {
7
+ float target = 0x1.fffffep-3f ;
8
+
9
+ __CPROVER_assume ((0 < startState ) && (fpclassify (startState ) == FP_NORMAL ) && (0x1p-126f <= startState ));
10
+
11
+ float secondPoint = (target / startState );
12
+
13
+ float nextState = (startState + secondPoint ) / 2 ;
14
+
15
+ float oneAfter = (target / nextState );
16
+
17
+ assert (oneAfter > 0 );
18
+ }
19
+
20
+ void simplifiedInductiveStepHunt (float nextState )
21
+ {
22
+ float target = 0x1.fffffep-3f ;
23
+
24
+ // Implies nextState == 0x1p+124f;
25
+ __CPROVER_assume ((0x1.fffffep+123f < nextState ) && (nextState < 0x1.000002p+124f ));
26
+
27
+ float oneAfter = (target / nextState );
28
+
29
+ // Is true and correctly proven by constant evaluation
30
+ // Note that this is the smallest normal number
31
+ assert (0x1.fffffep-3f / 0x1p+124f == 0x1p-126f );
32
+
33
+ assert (oneAfter > 0 );
34
+ }
35
+ #endif
36
+
37
+ int main (void )
38
+ {
39
+ #ifdef __GNUC__
40
+ // inductiveStepHunt(0x1p+125f);
41
+ // simplifiedInductiveStepHunt(0x1p+124f);
42
+
43
+ float f , g ;
44
+
45
+ inductiveStepHunt (f );
46
+ simplifiedInductiveStepHunt (g );
47
+ #endif
48
+
49
+ return 0 ;
50
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --floatbv --refine
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ class bv_refinementt:public bv_pointerst
108
108
// MEMBERS
109
109
110
110
bool progress;
111
- std::vector <approximationt> approximations;
111
+ std::list <approximationt> approximations;
112
112
bvt parent_assumptions;
113
113
protected:
114
114
// use gui format
Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ bv_refinementt::add_approximation(
487
487
const exprt &expr, bvt &bv)
488
488
{
489
489
approximations.push_back (approximationt (approximations.size ()));
490
- approximationt &a=approximations.back (); // stable!
490
+ approximationt &a=approximations.back ();
491
491
492
492
std::size_t width=boolbv_width (expr.type ());
493
493
PRECONDITION (width!=0 );
You can’t perform that action at this time.
0 commit comments