William M. Waite
University of Colorado
Each discussion of an elementary function implementation in our book Software Manual for the Elementary Functions includes a FORTRAN program to demonstrate the capabilities and limitations of any program evaluating that function. Output from these demonstration programs includes evidence that no major programming blunders have been made, statistical estimates of the overall accuracy of the program, and verification that all error conditions have been properly trapped. Detailed descriptions of specific tests are included in the discussions of the individual functions, and a general explanation of the testing procedure can be found in Chapter 3 of the book.
These programs use the uniform random number generator RAN. This generator is designed to return only about 29 random bits and is not suitable for machines without some additional synthesis of low-order bits. Randomness in the low-order bits is not as crucial as randomness in the high-order bits for our purposes, but it is essential that the low-order bits not all be 0.
Each of our test programs uses information about the floating-point arithmetic system. The radix and precision are required by all of the programs, and some of them require additional information about the largest and smallest positive floating-point numbers, whether the arithmetic rounds or chops, etc. The test programs call upon the environmental inquiry subprogram MACHAR, which dynamically determines these and other environmental parameters by exercising the floating-point arithmetic. This subprogram fails whenever the the active arithmetic registers retain floating-point quantities to more precision than stored numbers and use that extra precision in subsequent computation. MACHAR must be modified to force the storage and retrieval of important intermediate results on such machines. (The test programs may also fail in such cases, and the notes in the book indicate some, but perhaps not all, of the places where they too must be modified.) The contest program can be used to verify the operation of MACHAR.
The functions in the book make use of two primitive operations on the floating-point representation:
Each of the following sections links to the test program for the specified function.