summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/bc/Test/checklib.b
blob: 88ed2723b5535e103423284e5825a3f0013b5c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
define t (x,y,d,s,t) {
   auto u, v, w, i, b, c;

   if (s >= t) {
     "Bad Scales. Try again.
";   return;
   }

   for (i = x; i < y; i += d) {
     scale = s;
     u = f(i);
     scale = t;
     v = f(i);
     scale = s;
     w = v / 1;
     b += 1;
     if (u != w) {
       c += 1;
"
Failed:  
"
       "  index = "; i;
       "  val1 = "; u;
       "  val2 = "; v;
"
"
     }
   }

"
Total tests:    "; b;
"
Total failures: "; c;
"
Percent failed: "; scale = 2; c*100/b;

}


"
Checking e(x)"
define f(x) {
  return (e(x))
}
"
scale = 10"
j = t(-50,50,1,10,14)
"
scale = 20"
j = t(-50,50,1,20,24)

"
Checking l(x)"
define f(x) {
  return (l(x))
}
"
scale = 10"
j = t(1,10000,100,10,14)
"
scale = 20"
j = t(1,10000,100,20,24)

"
Checking s(x)"
define f(x) {
  return (s(x))
}
"
scale = 10"
j = t(0,8*a(1),.01,10,14)
"
scale = 20"
j = t(1,8*a(1),.01,20,24)

"
Checking a(x)"
define f(x) {
  return (a(x))
}
"
scale = 10"
j = t(-100,100,1,10,14)
"
scale = 20"
j = t(-100,100,1,20,24)

"
Checking j(n,x)"
define f(x) {
  return (j(n,x))
}
"
n=0, scale=10"
n=0
j = t(0,30,.1,10,14)
"
n=1, scale=10"
n=1
j = t(0,30,.1,10,14)
"
n=0, scale=20"
n=0
j = t(0,30,.1,20,24)
"
n=1, scale=20"
n=1
j = t(0,30,.1,20,24)