Blame Test/testfn.b

Packit 70b277
/* This function "t" tests the function "f" to see if computing at
Packit 70b277
   two different scales has much effect on the accuracy. 
Packit 70b277
   test from f(x) to f(y) incrementing the index by d.  f(i) is
Packit 70b277
   computed at two scales, scale s and then scale t, where t>s.
Packit 70b277
   the result from scale t is divided by 1 at scale s and the
Packit 70b277
   results are compared.  If they are different, the function is
Packit 70b277
   said to have failed.  It will then print out the value of i
Packit 70b277
   (called index) and the two original values val1 (scale s) and
Packit 70b277
   val2 (scale t) */
Packit 70b277
Packit 70b277
define t (x,y,d,s,t) {
Packit 70b277
   auto u, v, w, i, b, c;
Packit 70b277
Packit 70b277
   if (s >= t) {
Packit 70b277
     "Bad Scales. Try again.
Packit 70b277
";   return;
Packit 70b277
   }
Packit 70b277
Packit 70b277
   for (i = x; i < y; i += d) {
Packit 70b277
     scale = s;
Packit 70b277
     u = f(i);
Packit 70b277
     scale = t;
Packit 70b277
     v = f(i);
Packit 70b277
     scale = s;
Packit 70b277
     w = v / 1;
Packit 70b277
     b += 1;
Packit 70b277
     if (u != w) {
Packit 70b277
       c += 1;
Packit 70b277
"
Packit 70b277
Failed:  
Packit 70b277
"
Packit 70b277
       "  index = "; i;
Packit 70b277
       "  val1 = "; u;
Packit 70b277
       "  val2 = "; v;
Packit 70b277
"
Packit 70b277
"
Packit 70b277
     }
Packit 70b277
   }
Packit 70b277
Packit 70b277
"
Packit 70b277
Total tests:    "; b;
Packit 70b277
"
Packit 70b277
Total failures: "; c;
Packit 70b277
"
Packit 70b277
Percent failed: "; scale = 2; c*100/b;
Packit 70b277
Packit 70b277
}