| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 | 
                  ieetst, version 0.2   This software tests the numerical accuracy of floating pointbinary <-> decimal string conversion, as done by your C languagelibrary functions printf() and scanf(), for compliance with theIEEE arithmetic standards ANSI/IEEE Std 754-1985 and ANSI/IEEEStd 854-1987.  The test covers 32-bit float, 64-bit double, and80-bit long double precision conversions to and from decimalASCII strings.   The test program checks for proper implementation of thefollowing specifications of the standards:   (1) correctly rounded conversions of numbers of the form M *   10^N, where M and N are integers such that, in double precision,   for example, |M| < 10^17, |N| <= 27.   (2) binary -> decimal -> binary conversions to be an identity   if a sufficiently large number of decimal digits is requested.   (3) correctly rounded decimal outputs of less than the maximum   number of digits   (4) The maximum observed conversion error of numbers outside the   domain covered by (1) is reported by the test program; it is   not supposed to exceed 0.97 ulp.There are 10 separate tests.  Tests 1 through 6 use values near2^n and 10^n.  Test 7 addresses item (1) above.  Test 8 checksthe rounding of exact half-integer numbers. Test 9 is for item(4) above.  Test 10 checks denormal numbers.  Tests 8 through 10address item (3) using printf formats that produce outputs of 1,2, 3, ... digits after the decimal point.  All tests check, whenappropriate, that the binary output of scanf is the same as thebinary input to printf, item (2).Example error messages:   0000 0000 0000 1000 8000 3f80 ->printf-> 5.87748296e-39 ->scanf->   0000 0000 0000 0000 8000 3f6e  is not an identity.   scanf(-9.9999900000000003e-01) -> 0000 4800 085f ef39 ffff bffe    should be 0000 5000 085f ef39 ffff bffe .   printf("%.14e",  6.13592315154256467968352E-3) -> 6.13592315154257e-03   should be       6.13592315154256E-3 .Binary values are displayed as four-digit hex groups in thelittle-endian format of the internal reference arithmetic. Theleast significant 16-bit word is first, the exponent is last.   The design of the test program requires knowing the binarydata structure of the floating point format under test.  Forconfiguration, check the .h files carefully. All the programsneed to be told via mconf.h if the numeric format islittle-endian (IBMPC) or big-endian (MIEEE).  If your systemsupports an 80-bit long double precision data type, defineLDOUBLE 1 in ieetst.c; otherwise define LDOUBLE 0.  A provisionfor DEC PDP-11/VAX numbers is implemented (double precisiononly).  Conversions for other data structures can be added byanalogy to the ifdefs for DEC.   Most of the tests rely on comparison with the results of aportable reference arithmetic, contained in the file ieee.c. This is configured for an 80-bit significand, to have enoughprecision to satisfy the conversion requirements of IEEE 854 forthe extended double format of IEEE 754.  The reference arithmeticincludes binary <--> ASCII conversion routines and single <-->double <--> extended double conversions.  A strictly roundedsquare root function is given in esqrt.c.  Additional functionsare provided by elog.c, eexp.c, etanh.c, epow.c, all of whichcall on ieee.c for their arithmetic.  Some of the ANSI Cfunctions are supplied in ieee.c; for example, efloor(),efrexp(), eldexp(). The functions and the reference arithmeticare described further in the book _Methods and Programs forMathematical Functions_ (Prentice-Hall or Simon & SchusterInternational, 1989), by S. L. Moshier.   As an aid in diagnosis, a calculator program, ecalc.c, issupplied.  It uses ieee.c for its arithmetic. Documentation forthe calculator's user interface is in the file calc100.doc(calc100 is a fuller featured 100-digit version of ecalc).  Thecalculator needs to be told by qcalc.h if addresses are 32 bitslong (define LARGEMEM 1) or 16 bits long (define LARGEMEM 0).   Because the source code of ieee.c is included here, a versionof W. Kahan's PARANOIA is also provided; this has been heavilymodified by substituting subroutine calls to ieee.c in place ofall arithmetic operators.  It is important that you use PARANOIAto check the arithmetic after any modifications you may make toieee.c.   Several systems have been tested with the initial version ofieetst.  Sun 4 (SPARC) passes; DEC VMS C has only a small flaw;Microsoft flunks; ATT SysVR2 (Motorola) flunks even worse.   Files:calc100.doc     calculator documentatondescrip.mms     part of VAX VMS makefiledrand.c         random number generatorecalc.c         calculatorecalc.opt       part of VAX VMS makefileeconst.c        constants for reference arithmeticeexp.c          reference exponential functionehead.h         declarations for reference arithmetic routineselog.c          reference logarithmeparanoi.c      floating point arithmetic testereparanoi.opt    part of VAX VMS makefileepow.c          reference exponentiationesqrt.c         reference square rootetanh.c         reference hyperbolic tangentetodec.c        conversions to and from DEC double precision formatieee.c          the reference arithmeticieetst.c        printf/scanf testerieetst.doc      this fileieetst.mak      Microsoft make fileieetst.opt      part of VAX VMS makefilemakefile        Unix make filemconf.h         definitions for arithmetic formatmtherr.c        common error reporterqcalc.h         definitions for calculatorThis software may be copied freely.-- Steve Moshierv0.1   July, 1992v0.2   January, 1993
 |