ieetst.doc 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. ieetst, version 0.2
  2. This software tests the numerical accuracy of floating point
  3. binary <-> decimal string conversion, as done by your C language
  4. library functions printf() and scanf(), for compliance with the
  5. IEEE arithmetic standards ANSI/IEEE Std 754-1985 and ANSI/IEEE
  6. Std 854-1987. The test covers 32-bit float, 64-bit double, and
  7. 80-bit long double precision conversions to and from decimal
  8. ASCII strings.
  9. The test program checks for proper implementation of the
  10. following specifications of the standards:
  11. (1) correctly rounded conversions of numbers of the form M *
  12. 10^N, where M and N are integers such that, in double precision,
  13. for example, |M| < 10^17, |N| <= 27.
  14. (2) binary -> decimal -> binary conversions to be an identity
  15. if a sufficiently large number of decimal digits is requested.
  16. (3) correctly rounded decimal outputs of less than the maximum
  17. number of digits
  18. (4) The maximum observed conversion error of numbers outside the
  19. domain covered by (1) is reported by the test program; it is
  20. not supposed to exceed 0.97 ulp.
  21. There are 10 separate tests. Tests 1 through 6 use values near
  22. 2^n and 10^n. Test 7 addresses item (1) above. Test 8 checks
  23. the rounding of exact half-integer numbers. Test 9 is for item
  24. (4) above. Test 10 checks denormal numbers. Tests 8 through 10
  25. address item (3) using printf formats that produce outputs of 1,
  26. 2, 3, ... digits after the decimal point. All tests check, when
  27. appropriate, that the binary output of scanf is the same as the
  28. binary input to printf, item (2).
  29. Example error messages:
  30. 0000 0000 0000 1000 8000 3f80 ->printf-> 5.87748296e-39 ->scanf->
  31. 0000 0000 0000 0000 8000 3f6e is not an identity.
  32. scanf(-9.9999900000000003e-01) -> 0000 4800 085f ef39 ffff bffe
  33. should be 0000 5000 085f ef39 ffff bffe .
  34. printf("%.14e", 6.13592315154256467968352E-3) -> 6.13592315154257e-03
  35. should be 6.13592315154256E-3 .
  36. Binary values are displayed as four-digit hex groups in the
  37. little-endian format of the internal reference arithmetic. The
  38. least significant 16-bit word is first, the exponent is last.
  39. The design of the test program requires knowing the binary
  40. data structure of the floating point format under test. For
  41. configuration, check the .h files carefully. All the programs
  42. need to be told via mconf.h if the numeric format is
  43. little-endian (IBMPC) or big-endian (MIEEE). If your system
  44. supports an 80-bit long double precision data type, define
  45. LDOUBLE 1 in ieetst.c; otherwise define LDOUBLE 0. A provision
  46. for DEC PDP-11/VAX numbers is implemented (double precision
  47. only). Conversions for other data structures can be added by
  48. analogy to the ifdefs for DEC.
  49. Most of the tests rely on comparison with the results of a
  50. portable reference arithmetic, contained in the file ieee.c.
  51. This is configured for an 80-bit significand, to have enough
  52. precision to satisfy the conversion requirements of IEEE 854 for
  53. the extended double format of IEEE 754. The reference arithmetic
  54. includes binary <--> ASCII conversion routines and single <-->
  55. double <--> extended double conversions. A strictly rounded
  56. square root function is given in esqrt.c. Additional functions
  57. are provided by elog.c, eexp.c, etanh.c, epow.c, all of which
  58. call on ieee.c for their arithmetic. Some of the ANSI C
  59. functions are supplied in ieee.c; for example, efloor(),
  60. efrexp(), eldexp(). The functions and the reference arithmetic
  61. are described further in the book _Methods and Programs for
  62. Mathematical Functions_ (Prentice-Hall or Simon & Schuster
  63. International, 1989), by S. L. Moshier.
  64. As an aid in diagnosis, a calculator program, ecalc.c, is
  65. supplied. It uses ieee.c for its arithmetic. Documentation for
  66. the calculator's user interface is in the file calc100.doc
  67. (calc100 is a fuller featured 100-digit version of ecalc). The
  68. calculator needs to be told by qcalc.h if addresses are 32 bits
  69. long (define LARGEMEM 1) or 16 bits long (define LARGEMEM 0).
  70. Because the source code of ieee.c is included here, a version
  71. of W. Kahan's PARANOIA is also provided; this has been heavily
  72. modified by substituting subroutine calls to ieee.c in place of
  73. all arithmetic operators. It is important that you use PARANOIA
  74. to check the arithmetic after any modifications you may make to
  75. ieee.c.
  76. Several systems have been tested with the initial version of
  77. ieetst. Sun 4 (SPARC) passes; DEC VMS C has only a small flaw;
  78. Microsoft flunks; ATT SysVR2 (Motorola) flunks even worse.
  79. Files:
  80. calc100.doc calculator documentaton
  81. descrip.mms part of VAX VMS makefile
  82. drand.c random number generator
  83. ecalc.c calculator
  84. ecalc.opt part of VAX VMS makefile
  85. econst.c constants for reference arithmetic
  86. eexp.c reference exponential function
  87. ehead.h declarations for reference arithmetic routines
  88. elog.c reference logarithm
  89. eparanoi.c floating point arithmetic tester
  90. eparanoi.opt part of VAX VMS makefile
  91. epow.c reference exponentiation
  92. esqrt.c reference square root
  93. etanh.c reference hyperbolic tangent
  94. etodec.c conversions to and from DEC double precision format
  95. ieee.c the reference arithmetic
  96. ieetst.c printf/scanf tester
  97. ieetst.doc this file
  98. ieetst.mak Microsoft make file
  99. ieetst.opt part of VAX VMS makefile
  100. makefile Unix make file
  101. mconf.h definitions for arithmetic format
  102. mtherr.c common error reporter
  103. qcalc.h definitions for calculator
  104. This software may be copied freely.
  105. -- Steve Moshier
  106. v0.1 July, 1992
  107. v0.2 January, 1993