Berkeley TestFloat is a small collection of programs for testing whether an
implementation of binary floating-point conforms to the IEEE Standard for
All operations required by the original 1985 version of the IEEE Standard can
be tested, except for conversions to and from decimal.
With the current release, the following binary formats can be tested:
TestFloat performs relatively simple tests designed to check the fundamental soundness of a floating-point implementation. 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 division and the like (such as the infamous Pentium division bug). Pointers to software that tests for such failures are provided later on this page.
TestFloat works by comparing the behavior of the floating-point under test with that of the Berkeley SoftFloat software implementation of floating-point. Any differences found are reported as probable errors in the floating-point being tested. It is the responsibility of the user to verify that the discrepencies TestFloat finds actually represent faults in the floating-point being tested. Unfortunately, TestFloat’s output is not easily interpreted. Detailed knowledge of the IEEE Standard is required to use TestFloat responsibly.
TestFloat is distributed in the form of ISO/ANSI C source code and should be
compilable with almost any ISO-compliant C compiler.
Using the GNU C Compiler (
gcc), the TestFloat programs have been
compiled and run on several platforms.
To test a new floating-point implementation, some additional code will likely
be needed for invoking the new floating-point.
The current version of TestFloat is
The following archive contains all source code and documentation for
For those who may need it, TestFloat versions preceding
TestFloat requires Berkeley SoftFloat, which is not included in the TestFloat archive.
|Berkeley SoftFloat is a free, high-quality software implementation of binary floating-point that conforms to the IEEE Standard for Floating-Point Arithmetic.|
The TestFloat package includes a
testsoftfloat program solely for
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.
|The UCBTEST suite includes programs for testing the rounding of multiplication, division, and square roots, and also for testing the accuracy of elementary 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.|
|Fred Tydeman (Tydeman Consulting) provides the C99 FPCE Test Suite and several other programs for testing the floating-point compliance of C and C++ compilers and libraries.|
Berkeley TestFloat was written by me,
John R. Hauser.
Funding for the development of TestFloat
Bugs in TestFloat and other comments can be reported to me at