diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-04-03 10:26:12 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-04-03 10:26:12 +0000 |
commit | 915950ede281243b2c7a5400980ef16681cf3ab4 (patch) | |
tree | fb5ee2cd0ee875b4251cc441fb5f3c4ccae3bcd5 /test | |
parent | e53310b756c8e0e02ed41737dc3573cad33bc083 (diff) |
run dos2unix on these files
Diffstat (limited to 'test')
-rw-r--r-- | test/crypt/Makefile | 146 | ||||
-rw-r--r-- | test/math/Makefile | 182 | ||||
-rw-r--r-- | test/math/econst.c | 192 | ||||
-rw-r--r-- | test/math/eexp.c | 154 | ||||
-rw-r--r-- | test/math/ehead.h | 84 | ||||
-rw-r--r-- | test/math/elog.c | 184 | ||||
-rw-r--r-- | test/math/eparanoi.c | 7100 | ||||
-rw-r--r-- | test/math/epow.c | 430 | ||||
-rw-r--r-- | test/math/etanh.c | 104 | ||||
-rw-r--r-- | test/math/etodec.c | 362 | ||||
-rw-r--r-- | test/math/ieee.c | 8238 | ||||
-rw-r--r-- | test/math/ieetst.c | 1700 | ||||
-rw-r--r-- | test/math/ieetst.doc | 264 | ||||
-rw-r--r-- | test/math/mconf.h | 216 | ||||
-rw-r--r-- | test/math/mtherr.c | 192 |
15 files changed, 9774 insertions, 9774 deletions
diff --git a/test/crypt/Makefile b/test/crypt/Makefile index fe743aa45..a965466f3 100644 --- a/test/crypt/Makefile +++ b/test/crypt/Makefile @@ -1,73 +1,73 @@ -# Makefile for uClibc
-#
-# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-
-TESTDIR=../
-include $(TESTDIR)/Rules.mak
-
-TARGETS=diff md5c-test
-EXTRA_LIBS=-lcrypt
-
-all: $(TARGETS)
-
-crypt: crypt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -./$@ < crypt.input > $@.out 2>&1
- -@ echo " "
-
-crypt_glibc: crypt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs uClibc: "
- -@ echo " "
- $(HOST_CC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOST_CC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -./$@ < crypt.input > $@.out 2>&1
- -@ echo " "
-
-diff: crypt_glibc crypt
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u crypt_glibc.out crypt.out
- -@ echo " "
-
-md5c-test: md5c-test.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC)
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -./$@
- -@ echo " "
-
-clean:
- rm -f *.[oa] *~ core crypt_glibc crypt crypt_glibc.out crypt.out md5c-test
-
-
+# Makefile for uClibc +# +# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org> +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more +# details. +# +# You should have received a copy of the GNU Library General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + +TESTDIR=../ +include $(TESTDIR)/Rules.mak + +TARGETS=crypt md5c-test +EXTRA_LIBS=-lcrypt + +all: $(TARGETS) + +crypt: crypt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs uClibc: " + -@ echo " " + $(CC) $(CFLAGS) -c $< -o $@.o + $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ < crypt.input #> $@.out 2>&1 + -@ echo " " + +crypt_glibc: crypt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs uClibc: " + -@ echo " " + $(HOST_CC) $(GLIBC_CFLAGS) -c $< -o $@.o + $(HOST_CC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ < crypt.input > $@.out 2>&1 + -@ echo " " + +diff: crypt_glibc crypt + -@ echo "-------" + -@ echo " " + -@ echo "Diffing output: " + -@ echo " " + -diff -u crypt_glibc.out crypt.out + -@ echo " " + +md5c-test: md5c-test.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs uClibc: " + -@ echo " " + $(CC) $(CFLAGS) -c $< -o $@.o + $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ + -@ echo " " + +clean: + rm -f *.[oa] *~ core crypt_glibc crypt crypt_glibc.out crypt.out md5c-test + + diff --git a/test/math/Makefile b/test/math/Makefile index be7f261de..4d0bc5ee6 100644 --- a/test/math/Makefile +++ b/test/math/Makefile @@ -1,91 +1,91 @@ -# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-
-# Unix makefile for ieetst, eparanoi.
-# Set LARGEMEM 1 in qcalc.h for 32-bit memory addresses.
-# Define computer type and/or endianness in mconf.h.
-#
-# Configure eparanoi.c for desired arithmetic test;
-# also define appropriate version of setprec.o, or use a stub that
-# does no FPU setup. To test native arithmetic, eparanoi uses
-# the system libraries only; compile simply by `cc eparanoi.c -lm'.
-#
-
-TESTDIR=../
-include $(TESTDIR)/Rules.mak
-
-
-#CC = gcc
-#CFLAGS= -O
-INCS= mconf.h ehead.h
-OBJS = ieee.o econst.o eexp.o elog.o epow.o etanh.o etodec.o mtherr.o #setprec.o
-TARGETS=ieetst eparanoi
-
-all: $(TARGETS)
-
-ieetst: ieetst.o $(OBJS) drand.o $(INCS)
- $(CC) -o ieetst ieetst.o $(OBJS) drand.o -lc -lm
-
-eparanoi: eparanoi.o $(OBJS) $(INCS)
- $(CC) -o eparanoi eparanoi.o $(OBJS) -lc -lm
-
-#setprec.o: setprec.387
-# as -o setprec.o setprec.387
-
-#setprec.o: setprec.688
-# as -o setprec.o setprec.688
-
-ieee.o: ieee.c $(INCS)
- $(CC) $(CFLAGS) -c ieee.c
-
-econst.o: econst.c $(INCS)
- $(CC) $(CFLAGS) -c econst.c
-
-elog.o: elog.c $(INCS)
- $(CC) $(CFLAGS) -c elog.c
-
-eexp.o: eexp.c $(INCS)
- $(CC) $(CFLAGS) -c eexp.c
-
-etanh.o: etanh.c $(INCS)
- $(CC) $(CFLAGS) -c etanh.c
-
-epow.o: epow.c $(INCS)
- $(CC) $(CFLAGS) -c epow.c
-
-mtherr.o: mtherr.c $(INCS)
- $(CC) $(CFLAGS) -c mtherr.c
-
-ieetst.o: ieetst.c $(INCS)
- $(CC) $(CFLAGS) -c ieetst.c
-
-drand.o: drand.c $(INCS)
- $(CC) $(CFLAGS) -c drand.c
-
-etodec.o: etodec.c $(INCS)
- $(CC) $(CFLAGS) -c etodec.c
-
-eparanoi.o: eparanoi.c $(INCS)
- $(CC) $(CFLAGS) -c eparanoi.c
-
-clean:
- rm -f *.[oa] *~ core $(TARGETS)
-
-
+# Makefile for uClibc +# +# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more +# details. +# +# You should have received a copy of the GNU Library General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + +# Unix makefile for ieetst, eparanoi. +# Set LARGEMEM 1 in qcalc.h for 32-bit memory addresses. +# Define computer type and/or endianness in mconf.h. +# +# Configure eparanoi.c for desired arithmetic test; +# also define appropriate version of setprec.o, or use a stub that +# does no FPU setup. To test native arithmetic, eparanoi uses +# the system libraries only; compile simply by `cc eparanoi.c -lm'. +# + +TESTDIR=../ +include $(TESTDIR)/Rules.mak + + +#CC = gcc +#CFLAGS= -O +INCS= mconf.h ehead.h +OBJS = ieee.o econst.o eexp.o elog.o epow.o etanh.o etodec.o mtherr.o #setprec.o +TARGETS=ieetst eparanoi + +all: $(TARGETS) + +ieetst: ieetst.o $(OBJS) drand.o $(INCS) + $(CC) -o ieetst ieetst.o $(OBJS) drand.o -lc -lm + +eparanoi: eparanoi.o $(OBJS) $(INCS) + $(CC) -o eparanoi eparanoi.o $(OBJS) -lc -lm + +#setprec.o: setprec.387 +# as -o setprec.o setprec.387 + +#setprec.o: setprec.688 +# as -o setprec.o setprec.688 + +ieee.o: ieee.c $(INCS) + $(CC) $(CFLAGS) -c ieee.c + +econst.o: econst.c $(INCS) + $(CC) $(CFLAGS) -c econst.c + +elog.o: elog.c $(INCS) + $(CC) $(CFLAGS) -c elog.c + +eexp.o: eexp.c $(INCS) + $(CC) $(CFLAGS) -c eexp.c + +etanh.o: etanh.c $(INCS) + $(CC) $(CFLAGS) -c etanh.c + +epow.o: epow.c $(INCS) + $(CC) $(CFLAGS) -c epow.c + +mtherr.o: mtherr.c $(INCS) + $(CC) $(CFLAGS) -c mtherr.c + +ieetst.o: ieetst.c $(INCS) + $(CC) $(CFLAGS) -c ieetst.c + +drand.o: drand.c $(INCS) + $(CC) $(CFLAGS) -c drand.c + +etodec.o: etodec.c $(INCS) + $(CC) $(CFLAGS) -c etodec.c + +eparanoi.o: eparanoi.c $(INCS) + $(CC) $(CFLAGS) -c eparanoi.c + +clean: + rm -f *.[oa] *~ core $(TARGETS) + + diff --git a/test/math/econst.c b/test/math/econst.c index 21523e568..cfddbe3e2 100644 --- a/test/math/econst.c +++ b/test/math/econst.c @@ -1,96 +1,96 @@ -/* econst.c */
-/* e type constants used by high precision check routines */
-
-#include "ehead.h"
-
-
-#if NE == 10
-/* 0.0 */
-unsigned short ezero[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,};
-
-/* 5.0E-1 */
-unsigned short ehalf[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3ffe,};
-
-/* 1.0E0 */
-unsigned short eone[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,};
-
-/* 2.0E0 */
-unsigned short etwo[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4000,};
-
-/* 3.2E1 */
-unsigned short e32[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4004,};
-
-/* 6.93147180559945309417232121458176568075500134360255E-1 */
-unsigned short elog2[NE] =
- {0x40f3, 0xf6af, 0x03f2, 0xb398,
- 0xc9e3, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,};
-
-/* 1.41421356237309504880168872420969807856967187537695E0 */
-unsigned short esqrt2[NE] =
- {0x1d6f, 0xbe9f, 0x754a, 0x89b3,
- 0x597d, 0x6484, 0174736, 0171463, 0132404, 0x3fff,};
-
-/* 3.14159265358979323846264338327950288419716939937511E0 */
-unsigned short epi[NE] =
- {0x2902, 0x1cd1, 0x80dc, 0x628b,
- 0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,};
-
-/* 5.7721566490153286060651209008240243104215933593992E-1 */
-unsigned short eeul[NE] = {
-0xd1be,0xc7a4,0076660,0063743,0111704,0x3ffe,};
-
-#else
-
-/* 0.0 */
-unsigned short ezero[NE] = {
-0, 0000000,0000000,0000000,0000000,0000000,};
-/* 5.0E-1 */
-unsigned short ehalf[NE] = {
-0, 0000000,0000000,0000000,0100000,0x3ffe,};
-/* 1.0E0 */
-unsigned short eone[NE] = {
-0, 0000000,0000000,0000000,0100000,0x3fff,};
-/* 2.0E0 */
-unsigned short etwo[NE] = {
-0, 0000000,0000000,0000000,0100000,0040000,};
-/* 3.2E1 */
-unsigned short e32[NE] = {
-0, 0000000,0000000,0000000,0100000,0040004,};
-/* 6.93147180559945309417232121458176568075500134360255E-1 */
-unsigned short elog2[NE] = {
-0xc9e4,0x79ab,0150717,0013767,0130562,0x3ffe,};
-/* 1.41421356237309504880168872420969807856967187537695E0 */
-unsigned short esqrt2[NE] = {
-0x597e,0x6484,0174736,0171463,0132404,0x3fff,};
-/* 2/sqrt(PI) =
- * 1.12837916709551257389615890312154517168810125865800E0 */
-unsigned short eoneopi[NE] = {
-0x71d5,0x688d,0012333,0135202,0110156,0x3fff,};
-/* 3.14159265358979323846264338327950288419716939937511E0 */
-unsigned short epi[NE] = {
-0xc4c6,0xc234,0020550,0155242,0144417,0040000,};
-/* 5.7721566490153286060651209008240243104215933593992E-1 */
-unsigned short eeul[NE] = {
-0xd1be,0xc7a4,0076660,0063743,0111704,0x3ffe,};
-#endif
-extern unsigned short ezero[];
-extern unsigned short ehalf[];
-extern unsigned short eone[];
-extern unsigned short etwo[];
-extern unsigned short e32[];
-extern unsigned short elog2[];
-extern unsigned short esqrt2[];
-extern unsigned short eoneopi[];
-extern unsigned short epi[];
-extern unsigned short eeul[];
-
+/* econst.c */ +/* e type constants used by high precision check routines */ + +#include "ehead.h" + + +#if NE == 10 +/* 0.0 */ +unsigned short ezero[NE] = + {0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,}; + +/* 5.0E-1 */ +unsigned short ehalf[NE] = + {0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3ffe,}; + +/* 1.0E0 */ +unsigned short eone[NE] = + {0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,}; + +/* 2.0E0 */ +unsigned short etwo[NE] = + {0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4000,}; + +/* 3.2E1 */ +unsigned short e32[NE] = + {0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x4004,}; + +/* 6.93147180559945309417232121458176568075500134360255E-1 */ +unsigned short elog2[NE] = + {0x40f3, 0xf6af, 0x03f2, 0xb398, + 0xc9e3, 0x79ab, 0150717, 0013767, 0130562, 0x3ffe,}; + +/* 1.41421356237309504880168872420969807856967187537695E0 */ +unsigned short esqrt2[NE] = + {0x1d6f, 0xbe9f, 0x754a, 0x89b3, + 0x597d, 0x6484, 0174736, 0171463, 0132404, 0x3fff,}; + +/* 3.14159265358979323846264338327950288419716939937511E0 */ +unsigned short epi[NE] = + {0x2902, 0x1cd1, 0x80dc, 0x628b, + 0xc4c6, 0xc234, 0020550, 0155242, 0144417, 0040000,}; + +/* 5.7721566490153286060651209008240243104215933593992E-1 */ +unsigned short eeul[NE] = { +0xd1be,0xc7a4,0076660,0063743,0111704,0x3ffe,}; + +#else + +/* 0.0 */ +unsigned short ezero[NE] = { +0, 0000000,0000000,0000000,0000000,0000000,}; +/* 5.0E-1 */ +unsigned short ehalf[NE] = { +0, 0000000,0000000,0000000,0100000,0x3ffe,}; +/* 1.0E0 */ +unsigned short eone[NE] = { +0, 0000000,0000000,0000000,0100000,0x3fff,}; +/* 2.0E0 */ +unsigned short etwo[NE] = { +0, 0000000,0000000,0000000,0100000,0040000,}; +/* 3.2E1 */ +unsigned short e32[NE] = { +0, 0000000,0000000,0000000,0100000,0040004,}; +/* 6.93147180559945309417232121458176568075500134360255E-1 */ +unsigned short elog2[NE] = { +0xc9e4,0x79ab,0150717,0013767,0130562,0x3ffe,}; +/* 1.41421356237309504880168872420969807856967187537695E0 */ +unsigned short esqrt2[NE] = { +0x597e,0x6484,0174736,0171463,0132404,0x3fff,}; +/* 2/sqrt(PI) = + * 1.12837916709551257389615890312154517168810125865800E0 */ +unsigned short eoneopi[NE] = { +0x71d5,0x688d,0012333,0135202,0110156,0x3fff,}; +/* 3.14159265358979323846264338327950288419716939937511E0 */ +unsigned short epi[NE] = { +0xc4c6,0xc234,0020550,0155242,0144417,0040000,}; +/* 5.7721566490153286060651209008240243104215933593992E-1 */ +unsigned short eeul[NE] = { +0xd1be,0xc7a4,0076660,0063743,0111704,0x3ffe,}; +#endif +extern unsigned short ezero[]; +extern unsigned short ehalf[]; +extern unsigned short eone[]; +extern unsigned short etwo[]; +extern unsigned short e32[]; +extern unsigned short elog2[]; +extern unsigned short esqrt2[]; +extern unsigned short eoneopi[]; +extern unsigned short epi[]; +extern unsigned short eeul[]; + diff --git a/test/math/eexp.c b/test/math/eexp.c index dd2a64e1c..14ea9899d 100644 --- a/test/math/eexp.c +++ b/test/math/eexp.c @@ -1,77 +1,77 @@ -/* xexp.c */
-/* exponential function check routine */
-/* by Stephen L. Moshier. */
-
-
-#include "ehead.h"
-
-/*
-extern int powinited;
-extern short maxposint[], maxnegint[];
-*/
-
-void eexp( x, y )
-unsigned short *x, *y;
-{
-unsigned short num[NE], den[NE], x2[NE];
-long i;
-unsigned short sign, expchk;
-
-/* range reduction theory: x = i + f, 0<=f<1;
- * e**x = e**i * e**f
- * e**i = 2**(i/log 2).
- * Let i/log2 = i1 + f1, 0<=f1<1.
- * Then e**i = 2**i1 * 2**f1, so
- * e**x = 2**i1 * e**(log 2 * f1) * e**f.
- */
-/*
-if( powinited == 0 )
- initpow();
-*/
-if( ecmp(x, ezero) == 0 )
- {
- emov( eone, y );
- return;
- }
-emov(x, x2);
-expchk = x2[NE-1];
-sign = expchk & 0x8000;
-x2[NE-1] &= 0x7fff;
-
-/* Test for excessively large argument */
-expchk &= 0x7fff;
-if( expchk > (EXONE + 15) )
- {
- eclear( y );
- if( sign == 0 )
- einfin( y );
- return;
- }
-
-eifrac( x2, &i, num ); /* x = i + f */
-
-if( i != 0 )
- {
- ltoe( &i, den ); /* floating point i */
- ediv( elog2, den, den ); /* i/log 2 */
- eifrac( den, &i, den ); /* i/log 2 = i1 + f1 */
- emul( elog2, den, den ); /* log 2 * f1 */
- eadd( den, num, x2 ); /* log 2 * f1 + f */
- }
-
-/*x2[NE-1] -= 1;*/
-eldexp( x2, -1L, x2 ); /* divide by 2 */
-etanh( x2, x2 ); /* tanh( x/2 ) */
-eadd( x2, eone, num ); /* 1 + tanh */
-eneg( x2 );
-eadd( x2, eone, den ); /* 1 - tanh */
-ediv( den, num, y ); /* (1 + tanh)/(1 - tanh) */
-
-/*y[NE-1] += i;*/
-if( sign )
- {
- ediv( y, eone, y );
- i = -i;
- }
-eldexp( y, i, y ); /* multiply by 2**i */
-}
+/* xexp.c */ +/* exponential function check routine */ +/* by Stephen L. Moshier. */ + + +#include "ehead.h" + +/* +extern int powinited; +extern short maxposint[], maxnegint[]; +*/ + +void eexp( x, y ) +unsigned short *x, *y; +{ +unsigned short num[NE], den[NE], x2[NE]; +long i; +unsigned short sign, expchk; + +/* range reduction theory: x = i + f, 0<=f<1; + * e**x = e**i * e**f + * e**i = 2**(i/log 2). + * Let i/log2 = i1 + f1, 0<=f1<1. + * Then e**i = 2**i1 * 2**f1, so + * e**x = 2**i1 * e**(log 2 * f1) * e**f. + */ +/* +if( powinited == 0 ) + initpow(); +*/ +if( ecmp(x, ezero) == 0 ) + { + emov( eone, y ); + return; + } +emov(x, x2); +expchk = x2[NE-1]; +sign = expchk & 0x8000; +x2[NE-1] &= 0x7fff; + +/* Test for excessively large argument */ +expchk &= 0x7fff; +if( expchk > (EXONE + 15) ) + { + eclear( y ); + if( sign == 0 ) + einfin( y ); + return; + } + +eifrac( x2, &i, num ); /* x = i + f */ + +if( i != 0 ) + { + ltoe( &i, den ); /* floating point i */ + ediv( elog2, den, den ); /* i/log 2 */ + eifrac( den, &i, den ); /* i/log 2 = i1 + f1 */ + emul( elog2, den, den ); /* log 2 * f1 */ + eadd( den, num, x2 ); /* log 2 * f1 + f */ + } + +/*x2[NE-1] -= 1;*/ +eldexp( x2, -1L, x2 ); /* divide by 2 */ +etanh( x2, x2 ); /* tanh( x/2 ) */ +eadd( x2, eone, num ); /* 1 + tanh */ +eneg( x2 ); +eadd( x2, eone, den ); /* 1 - tanh */ +ediv( den, num, y ); /* (1 + tanh)/(1 - tanh) */ + +/*y[NE-1] += i;*/ +if( sign ) + { + ediv( y, eone, y ); + i = -i; + } +eldexp( y, i, y ); /* multiply by 2**i */ +} diff --git a/test/math/ehead.h b/test/math/ehead.h index 746b60df7..24c95ce05 100644 --- a/test/math/ehead.h +++ b/test/math/ehead.h @@ -1,42 +1,42 @@ -
-/* Include file for extended precision arithmetic programs.
- */
-
-/* Number of 16 bit words in external x type format */
-#define NE 6
-
-/* Number of 16 bit words in internal format */
-#define NI (NE+3)
-
-/* Array offset to exponent */
-#define E 1
-
-/* Array offset to high guard word */
-#define M 2
-
-/* Number of bits of precision */
-#define NBITS ((NI-4)*16)
-
-/* Maximum number of decimal digits in ASCII conversion
- * = NBITS*log10(2)
- */
-#define NDEC (NBITS*8/27)
-
-/* The exponent of 1.0 */
-#define EXONE (0x3fff)
-
-void eadd(), esub(), emul(), ediv();
-int ecmp(), enormlz(), eshift();
-void eshup1(), eshup8(), eshup6(), eshdn1(), eshdn8(), eshdn6();
-void eabs(), eneg(), emov(), eclear(), einfin(), efloor();
-void eldexp(), efrexp(), eifrac(), ltoe();
-void esqrt(), elog(), eexp(), etanh(), epow();
-void asctoe(), asctoe24(), asctoe53(), asctoe64();
-void etoasc(), e24toasc(), e53toasc(), e64toasc();
-void etoe64(), etoe53(), etoe24(), e64toe(), e53toe(), e24toe();
-void mtherr();
-extern unsigned short ezero[], ehalf[], eone[], etwo[];
-extern unsigned short elog2[], esqrt2[];
-
-
-/* by Stephen L. Moshier. */
+ +/* Include file for extended precision arithmetic programs. + */ + +/* Number of 16 bit words in external x type format */ +#define NE 6 + +/* Number of 16 bit words in internal format */ +#define NI (NE+3) + +/* Array offset to exponent */ +#define E 1 + +/* Array offset to high guard word */ +#define M 2 + +/* Number of bits of precision */ +#define NBITS ((NI-4)*16) + +/* Maximum number of decimal digits in ASCII conversion + * = NBITS*log10(2) + */ +#define NDEC (NBITS*8/27) + +/* The exponent of 1.0 */ +#define EXONE (0x3fff) + +void eadd(), esub(), emul(), ediv(); +int ecmp(), enormlz(), eshift(); +void eshup1(), eshup8(), eshup6(), eshdn1(), eshdn8(), eshdn6(); +void eabs(), eneg(), emov(), eclear(), einfin(), efloor(); +void eldexp(), efrexp(), eifrac(), ltoe(); +void esqrt(), elog(), eexp(), etanh(), epow(); +void asctoe(), asctoe24(), asctoe53(), asctoe64(); +void etoasc(), e24toasc(), e53toasc(), e64toasc(); +void etoe64(), etoe53(), etoe24(), e64toe(), e53toe(), e24toe(); +void mtherr(); +extern unsigned short ezero[], ehalf[], eone[], etwo[]; +extern unsigned short elog2[], esqrt2[]; + + +/* by Stephen L. Moshier. */ diff --git a/test/math/elog.c b/test/math/elog.c index 8afc1e5b4..bc517b197 100644 --- a/test/math/elog.c +++ b/test/math/elog.c @@ -1,92 +1,92 @@ -/* xlog.c */
-/* natural logarithm */
-/* by Stephen L. Moshier. */
-
-#include "mconf.h"
-#include "ehead.h"
-
-
-
-void elog( x, y )
-unsigned short *x, *y;
-{
-unsigned short xx[NE], z[NE], a[NE], b[NE], t[NE], qj[NE];
-long ex;
-int fex;
-
-
-if( x[NE-1] & (unsigned short )0x8000 )
- {
- eclear(y);
- mtherr( "elog", DOMAIN );
- return;
- }
-if( ecmp( x, ezero ) == 0 )
- {
- einfin( y );
- eneg(y);
- mtherr( "elog", SING );
- return;
- }
-if( ecmp( x, eone ) == 0 )
- {
- eclear( y );
- return;
- }
-
-/* range reduction: log x = log( 2**ex * m ) = ex * log2 + log m */
-efrexp( x, &fex, xx );
-/*
-emov(x, xx );
-ex = xx[NX-1] & 0x7fff;
-ex -= 0x3ffe;
-xx[NX-1] = 0x3ffe;
-*/
-
-/* Adjust range to 1/sqrt(2), sqrt(2) */
-esqrt2[NE-1] -= 1;
-if( ecmp( xx, esqrt2 ) < 0 )
- {
- fex -= 1;
- emul( xx, etwo, xx );
- }
-esqrt2[NE-1] += 1;
-
-esub( eone, xx, a );
-if( a[NE-1] == 0 )
- {
- eclear( y );
- goto logdon;
- }
-eadd( eone, xx, b );
-ediv( b, a, y ); /* store (x-1)/(x+1) in y */
-
-emul( y, y, z );
-
-emov( eone, a );
-emov( eone, b );
-emov( eone, qj );
-do
- {
- eadd( etwo, qj, qj ); /* 2 * i + 1 */
- emul( z, a, a );
- ediv( qj, a, t );
- eadd( t, b, b );
- }
-while( ((b[NE-1] & 0x7fff) - (t[NE-1] & 0x7fff)) < NBITS );
-
-
-emul( b, y, y );
-emul( y, etwo, y );
-
-logdon:
-
-/* now add log of 2**ex */
-if( fex != 0 )
- {
- ex = fex;
- ltoe( &ex, b );
- emul( elog2, b, b );
- eadd( b, y, y );
- }
-}
+/* xlog.c */ +/* natural logarithm */ +/* by Stephen L. Moshier. */ + +#include "mconf.h" +#include "ehead.h" + + + +void elog( x, y ) +unsigned short *x, *y; +{ +unsigned short xx[NE], z[NE], a[NE], b[NE], t[NE], qj[NE]; +long ex; +int fex; + + +if( x[NE-1] & (unsigned short )0x8000 ) + { + eclear(y); + mtherr( "elog", DOMAIN ); + return; + } +if( ecmp( x, ezero ) == 0 ) + { + einfin( y ); + eneg(y); + mtherr( "elog", SING ); + return; + } +if( ecmp( x, eone ) == 0 ) + { + eclear( y ); + return; + } + +/* range reduction: log x = log( 2**ex * m ) = ex * log2 + log m */ +efrexp( x, &fex, xx ); +/* +emov(x, xx ); +ex = xx[NX-1] & 0x7fff; +ex -= 0x3ffe; +xx[NX-1] = 0x3ffe; +*/ + +/* Adjust range to 1/sqrt(2), sqrt(2) */ +esqrt2[NE-1] -= 1; +if( ecmp( xx, esqrt2 ) < 0 ) + { + fex -= 1; + emul( xx, etwo, xx ); + } +esqrt2[NE-1] += 1; + +esub( eone, xx, a ); +if( a[NE-1] == 0 ) + { + eclear( y ); + goto logdon; + } +eadd( eone, xx, b ); +ediv( b, a, y ); /* store (x-1)/(x+1) in y */ + +emul( y, y, z ); + +emov( eone, a ); +emov( eone, b ); +emov( eone, qj ); +do + { + eadd( etwo, qj, qj ); /* 2 * i + 1 */ + emul( z, a, a ); + ediv( qj, a, t ); + eadd( t, b, b ); + } +while( ((b[NE-1] & 0x7fff) - (t[NE-1] & 0x7fff)) < NBITS ); + + +emul( b, y, y ); +emul( y, etwo, y ); + +logdon: + +/* now add log of 2**ex */ +if( fex != 0 ) + { + ex = fex; + ltoe( &ex, b ); + emul( elog2, b, b ); + eadd( b, y, y ); + } +} diff --git a/test/math/eparanoi.c b/test/math/eparanoi.c index 0e479f9f5..84cab73f8 100644 --- a/test/math/eparanoi.c +++ b/test/math/eparanoi.c @@ -1,3550 +1,3550 @@ -/* paranoia.c arithmetic tester
- *
- * This is an implementation of the PARANOIA program. It substitutes
- * subroutine calls for ALL floating point arithmetic operations.
- * This permits you to substitute your own experimental versions of
- * arithmetic routines. It also defeats compiler optimizations,
- * so for native arithmetic you can be pretty sure you are testing
- * the arithmetic and not the compiler.
- *
- * This version of PARANOIA omits the display of division by zero.
- * It also omits the test for extra precise subexpressions, since
- * they cannot occur in this context. Otherwise it includes all the
- * tests of the 27 Jan 86 distribution, plus a few additional tests.
- * Commentary has been reduced to a minimum in order to make the program
- * smaller.
- *
- * The original PARANOIA program, written by W. Kahan, C version
- * by Thos Sumner and David Gay, can be downloaded free from the
- * Internet NETLIB. An MSDOS disk can be obtained for $15 from:
- * Richard Karpinski
- * 6521 Raymond Street
- * Oakland, CA 94609
- *
- * Steve Moshier, 28 Oct 88
- * last rev: 23 May 92
- */
-
-#define DEBUG 0
-
-/* To use the native arithmetic of the computer, define NATIVE
- * to be 1. To use your own supplied arithmetic routines, NATIVE is 0.
- */
-#define NATIVE 0
-
-/* gcc real.c interface */
-#define L128DOUBLE 0
-
-#include <stdio.h>
-
-
-
-
-/* Data structure of floating point number. If NATIVE was
- * selected above, you can define LDOUBLE 1 to test 80-bit long double
- * precision or define it 0 to test 64-bit double precision.
-*/
-#define LDOUBLE 0
-#if NATIVE
-
-#define NE 1
-#if LDOUBLE
-#define FSIZE long double
-#define FLOAT(x) FSIZE x[NE]
-static FSIZE eone[NE] = {1.0L}; /* The constant 1.0 */
-#define ZSQRT sqrtl
-#define ZLOG logl
-#define ZFLOOR floorl
-#define ZPOW powl
-long double sqrtl(), logl(), floorl(), powl();
-#define FSETUP einit
-#else /* not LDOUBLE */
-#define FSIZE double
-#define FLOAT(x) FSIZE x[NE]
-static FSIZE eone[NE] = {1.0}; /* The constant 1.0 */
-#define ZSQRT sqrt
-#define ZLOG log
-#define ZFLOOR floor
-#define ZPOW pow
-double sqrt(), log(), floor(), pow();
-/* Coprocessor initialization,
- * defeat underflow trap or what have you.
- * This is required mainly on i386 and 68K processors.
- */
-#define FSETUP dprec
-#endif /* double, not LDOUBLE */
-
-#else /* not NATIVE */
-
-/* Setup for extended double type.
- * Put NE = 10 for real.c operating with TFmode support (16-byte reals)
- * Put NE = 6 for real.c operating with XFmode support (10- or 12-byte reals)
- * The value of NE must agree with that in ehead.h, if ieee.c is used.
- */
-#define NE 6
-#define FSIZE unsigned short
-#define FLOAT(x) unsigned short x[NE]
-extern unsigned short eone[];
-#define FSETUP einit
-
-/* default for FSETUP */
-/*
-einit()
-{}
-*/
-
-error(s)
-char *s;
-{
-printf( "error: %s\n", s );
-}
-
|