Beispiel #1
0
void nonlin_f()
{
  a = Frama_C_float_interval(5.0, 7.0);
  b = Frama_C_float_interval(0.0, 1.0);
  c = 7.0;
  d = a;
  /*@ assert (5.0 <= d) ; */

  r1 = a + (b * (c - a));
  /*@ assert
       (5.0 <= a <= 5.125)
    || (5.125 <= a <= 5.25)
    || (5.25 <= a <= 5.375)
    || (5.375 <= a <= 5.5)
    || (5.5 <= a <= 5.625)
    || (5.625 <= a <= 5.75)
    || (5.75 <= a <= 5.875)
    || (5.875 <= a <= 6.0)
    || (6.0 <= a <= 6.125)
    || (6.125 <= a <= 6.25)
    || (6.25 <= a <= 6.375)
    || (6.375 <= a <= 6.5)
    || (6.5 <= a <= 6.625)
    || (6.625 <= a <= 6.75)
    || (6.75 <= a <= 6.875)
    || (6.875 <= a <= 7.0) ; */

  r2 = (b * (c - a)) + a;
  Frama_C_show_each_a_r2("a", a, "r2", r2);
}
Beispiel #2
0
void other() {
  i = Frama_C_float_interval(-133.0,142.0);
  s = Frama_C_float_interval(-133.0,142.0);
  r = 1 + t[(int)(i*i+2.0)];
  z = (int)(10000.0 * (s - s));
  zf = s - s;
  s2 = s + s;
  sq = s * s;
  h = s * (1 - s);
  rbits2 = access_bits(i);

  x = Frama_C_interval(0,42);
  y = (1 / x) * x;
}
Beispiel #3
0
int main(){
  float f = Frama_C_float_interval(-3.1875, -3.1875+0.25);  
  while (f <= 3.1875)
    { //Frama_C_show_each_f(f);
      Frama_C_show_each_s((float)sin(f));
      Frama_C_show_each_c((float)cos(f));
      f += 0.25;
    }
  return 0;
}
Beispiel #4
0
// Tests possible bugs of the subdivision around the zero values.
void around_zeros() {
  /* [f1] is the smallest positive float, and [f] has values in [-0 .. f1].
     While [next_float_ieee -0. = f1], the interval [-0. .. f1] contains three
     float values, so its subdivision should not forget +0. */
  float f1 = 1.4E-45;
  float f = Frama_C_float_interval(-0, f1);
  /* The +f-f is needed to activate the subdivisions.
     The [f1] value is removed from [f], which must become [-0. .. 0.]
     and not the singleton {-0.}.  */
  float res = f1 / (f+f-f - f1);
}