John Hauser

TestFloat

TestFloat is a program for testing whether a computer's floating-point conforms to the IEC/IEEE Standard for Binary Floating-point Arithmetic. TestFloat works by comparing the behavior of the machine's floating-point with that of the SoftFloat software implementation of floating-point. Any differences found are reported as probable errors in the machine's floating-point.

TestFloat performs relatively simple tests designed to check the fundamental soundness of the floating-point under test. All of the modes and special cases of the IEEE Standard are tested. However, TestFloat is not especially good at testing difficult rounding cases for divisions and square roots. It also makes no attempt to find bugs specific to SRT divisions and the like (such as the infamous Pentium divide bug). Pointers to software that tests for such failures are provided later on this page.

It is the responsibility of the user to verify that the discrepencies TestFloat finds actually represent faults in the system being tested. Unfortunately, TestFloat's output is not easily interpreted. Detailed knowledge of the IEEE Standard is required to use TestFloat responsibly.

Release 2a

The current version of TestFloat is Release 2a (1998 December). This release adds the ability to test conversions between floating-point and 64-bit integers (when the compiler supports them). The makefiles have also been restructured to be more adaptable.

Known system bugs found by TestFloat

TestFloat has found at least one bug on more than half the computers I have run it on. The bugs that TestFloat finds are listed in a file included in the TestFloat package:
-> text file, systemBugs.txt [16 kB].
Most if not all of these bugs have been previously documented. In general, for an established machine, the bugs turned up by TestFloat are very likely to be already known to the manufacturer, though they may not be widely advertised.

I myself have run TestFloat on only a handful of machines. If you find bugs not on this list, feel free to drop me a note and I'll update the list.

TestFloat executables

The following archives contain everything you need for testing the floating-point of an Intel 386 or compatible machine:

TestFloat source files

TestFloat is written in ISO/ANSI C and should be compilable with any ISO-compliant C compiler. Old-style compilers are not supported. Using the GNU C Compiler (gcc), TestFloat has been compiled and run on several platforms. Because ISO C does not give full access to the features of IEEE floating-point, porting TestFloat involves some target-dependent programming.

The following files comprise Release 2a of TestFloat:

TestFloat requires SoftFloat, which is not included in the TestFloat archive.
[] SoftFloat is a free, high-quality software implementation of floating-point that conforms to the IEC/IEEE Standard for Binary Floating-point Arithmetic.

Testing SoftFloat

The TestFloat sources actually include two test programs, one for testing a machine's floating-point by comparing against SoftFloat, and another for testing SoftFloat itself. SoftFloat is tested by comparing it against yet another, different software floating-point that is simpler and also slower than SoftFloat. Although one can't be completely certain that the other floating-point is correct either, it's unlikely that it would make exactly the same mistakes as SoftFloat. Any unexpected discrepancies between the two floating-points are flagged as probable errors in one or the other.

Other software for testing floating-point

[] The UCBTEST suite includes programs for testing the rounding of multiplies, divides, and square roots, and also for testing the accuracy of basic transcendental functions. UCBTEST can be found in the NetLib Repository, under the fp (floating-point) directory.
[] W. Kahan at U.C. Berkeley has made a few test programs available on the Web, notably the SRTEST program for testing SRT division.

Credit and contacts

TestFloat was written by me, John R. Hauser. Bugs in TestFloat and other comments can be reported to me at jh@jhauser.us.



John Hauser, 2010 June 1