value_t a(index_t n) { /* printf ("LOG: acc = %d, looking up %u\n", acc, n); */ int i; for (i = 0; i <= acc; i++) { if (ind[i] == n) { /* printf ("LOG: found %u with val %d\n", n, val[i]); */ return val[i]; } } value_t v = nondet_value(); for (i = 0; i <= acc; i++) { /* printf ("LOG: COMPARING to %d (a[%u] = %d)\n", i, ind[i], val[i]); */ if (ind[i] < n) { __CPROVER_assume(v >= val[i]); } else { __CPROVER_assume(v <= val[i]); } } acc = acc + 1; assert(acc < MAX_ITEMS); /* printf("LOG: a[%u] = %d\n", n, v); */ val[acc] = v; ind[acc] = n; return v; }
int main (void) { float f1 = 0x1.0p+0; float f2 = 0x1.8p-24; // Test with constant folding roundingTest(f1,f2); // Test with bitwise model float f3 = nondet_value(); float f4 = nondet_value(); assume((0x1.fffffep-1f < f3) && (f3 < 0x1.000002p+0f)); assume((0x1.7ffffep-24f < f4) && (f4 < 0x1.800002p-24f)); roundingTest(f3,f4); return 0; }