summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1993-04-10 15:54:16 +0000
committercgd <cgd@NetBSD.org>1993-04-10 15:54:16 +0000
commitf625cfdcdff089f709690f38de13294995c0a565 (patch)
treee710f4a9742138b1a1372b73c5062fe7074a8727 /gnu
parent85eccea790fd01346054df8183802a929f7e133b (diff)
gnu bc. necessary to compile the distribution
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/bc-1.02/Test/sqrt.b4
-rw-r--r--gnu/usr.bin/bc-1.02/Test/testfn.b47
-rw-r--r--gnu/usr.bin/bc-1.02/Test/timetest14
-rw-r--r--gnu/usr.bin/bc/Test/sqrt.b4
-rw-r--r--gnu/usr.bin/bc/Test/testfn.b47
-rw-r--r--gnu/usr.bin/bc/Test/timetest14
6 files changed, 130 insertions, 0 deletions
diff --git a/gnu/usr.bin/bc-1.02/Test/sqrt.b b/gnu/usr.bin/bc-1.02/Test/sqrt.b
new file mode 100644
index 00000000000..6365794b2f0
--- /dev/null
+++ b/gnu/usr.bin/bc-1.02/Test/sqrt.b
@@ -0,0 +1,4 @@
+scale = 20
+for (a=1; a<500; a++) r=sqrt(a)
+r
+quit
diff --git a/gnu/usr.bin/bc-1.02/Test/testfn.b b/gnu/usr.bin/bc-1.02/Test/testfn.b
new file mode 100644
index 00000000000..7578fc5d45f
--- /dev/null
+++ b/gnu/usr.bin/bc-1.02/Test/testfn.b
@@ -0,0 +1,47 @@
+/* This function "t" tests the function "f" to see if computing at
+ two different scales has much effect on the accuracy.
+ test from f(x) to f(y) incrementing the index by d. f(i) is
+ computed at two scales, scale s and then scale t, where t>s.
+ the result from scale t is divided by 1 at scale s and the
+ results are compared. If they are different, the function is
+ said to have failed. It will then print out the value of i
+ (called index) and the two original values val1 (scale s) and
+ val2 (scale t) */
+
+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;
+
+}
diff --git a/gnu/usr.bin/bc-1.02/Test/timetest b/gnu/usr.bin/bc-1.02/Test/timetest
new file mode 100644
index 00000000000..90da6ab7ad6
--- /dev/null
+++ b/gnu/usr.bin/bc-1.02/Test/timetest
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# Time the functions.
+#
+BC=../bc
+SYSBC=/usr/bin/bc
+for file in exp.b ln.b sine.b atan.b jn.b mul.b div.b raise.b sqrt.b
+do
+for prog in $BC $SYSBC
+do
+echo Timing $file with $prog
+time $prog -l $file
+done
+done
diff --git a/gnu/usr.bin/bc/Test/sqrt.b b/gnu/usr.bin/bc/Test/sqrt.b
new file mode 100644
index 00000000000..6365794b2f0
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/sqrt.b
@@ -0,0 +1,4 @@
+scale = 20
+for (a=1; a<500; a++) r=sqrt(a)
+r
+quit
diff --git a/gnu/usr.bin/bc/Test/testfn.b b/gnu/usr.bin/bc/Test/testfn.b
new file mode 100644
index 00000000000..7578fc5d45f
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/testfn.b
@@ -0,0 +1,47 @@
+/* This function "t" tests the function "f" to see if computing at
+ two different scales has much effect on the accuracy.
+ test from f(x) to f(y) incrementing the index by d. f(i) is
+ computed at two scales, scale s and then scale t, where t>s.
+ the result from scale t is divided by 1 at scale s and the
+ results are compared. If they are different, the function is
+ said to have failed. It will then print out the value of i
+ (called index) and the two original values val1 (scale s) and
+ val2 (scale t) */
+
+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;
+
+}
diff --git a/gnu/usr.bin/bc/Test/timetest b/gnu/usr.bin/bc/Test/timetest
new file mode 100644
index 00000000000..90da6ab7ad6
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/timetest
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# Time the functions.
+#
+BC=../bc
+SYSBC=/usr/bin/bc
+for file in exp.b ln.b sine.b atan.b jn.b mul.b div.b raise.b sqrt.b
+do
+for prog in $BC $SYSBC
+do
+echo Timing $file with $prog
+time $prog -l $file
+done
+done