Release calc version 2.12.2

This commit is contained in:
Landon Curt Noll
2007-09-02 02:18:44 -07:00
parent f62d9fa1e6
commit ca0dd4560b
553 changed files with 13059 additions and 5440 deletions

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is
* distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 29.2 $
* @(#) $Id: test2600.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
* @(#) $Revision: 30.2 $
* @(#) $Id: test2600.cal,v 30.2 2007/07/11 22:57:23 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2600.cal,v $
*
* Under source code control: 1995/10/13 00:13:14
@@ -313,6 +313,102 @@ define testpower(str, n, b, eps, verbose)
}
define testpower2(str, n, eps, verbose)
{
local i, a, c, m, min, max;
local b;
local num;
local c2;
local oldeps;
if (isnull(verbose)) verbose = 2;
if (verbose > 0) {
print str:":",:;
}
if (isnull(eps))
eps = epsilon();
oldeps = epsilon(eps);
epsilon(eps),;
if (!isnum(b))
quit "Second argument (exponent) to be a number";
min = 1000;
max = -1000;
for (i = 1; i <= n; i++) {
if (verbose > 2) print i,:;
/* real ^ real */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = a ^ b;
c2 = power(a, b);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** real^real failure for a = %d\n", a);
}
}
/* complex ^ real */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = (a*1i) ^ b;
c2 = power(a*1i, b);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** comp^real failure for a = %d\n", a);
}
}
/* real ^ complex */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = a ^ (b*1i);
c2 = power(a, b*1i);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** real^comp failure for a = %d\n", a);
}
}
/* complex ^ complex */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = (a*1i) ^ (b*1i);
c2 = power(a*1i, b*1i);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** comp^comp failure for a = %d\n", a);
}
}
}
epsilon(oldeps),;
if (verbose > 0) {
if (m) {
printf("*** %d error(s)\n", m);
printf(" %s: rem/eps min=%d, max=%d\n",
str, min, max);
} else {
printf("no errors\n");
}
}
if (verbose > 1) {
printf(" %s: rem/eps min=%0.4d, max=%0.4d\n", str, min, max);
}
return m;
}
define cpow(a, b, eps) /* Find rem/eps for power(a,b,eps) */
{
local v, v1, c, n, d, h;
@@ -504,6 +600,7 @@ define test2600(verbose, tnum)
err += testsqrt(strcat(str(tnum++),": sqrt",str(i)), n*10,
ep, verbose);
}
err += testpower2(strcat(str(tnum++),": power"), n*4, ep, verbose);
if (verbose > 1) {
if (err) {
print "***", err, "error(s) found in test2600";