John Hauser


SoftFloat is a free, high-quality software implementation of the IEC/IEEE Standard for Binary Floating-point Arithmetic. (IEC is the International Electrotechnical Commission, an international standards body.) SoftFloat is completely faithful to the IEEE Standard, while at the same time being relatively fast. All functions dictated by the standard are supported except for conversions to and from decimal. SoftFloat fully implements the four most common floating-point formats: single precision (32 bits), double precision (64 bits), extended double precision (80 bits), and quadruple precision (128 bits). All required rounding modes, exception flags, and special values are supported.

SoftFloat is distributed in the form of ISO/ANSI C source code and should be compilable with almost any ISO-compliant C compiler. Old-style compilers are not supported. Using the GNU C Compiler (gcc), the package has been compiled and tested for several platforms. Target-specific code is provided for 386 and SPARC processors. Other machines can be targeted using these two as examples.

SoftFloat's code for the extended double-precision and quadruple-precision formats depends on the existence of a 64-bit integer type in C. If the C compiler used to compile SoftFloat does not support 64-bit integers, SoftFloat will be limited to single and double precisions only.

More information about SoftFloat can be found in the following text files from the SoftFloat package:
-- README.txt - Package Overview for SoftFloat Release 2b.
-- SoftFloat.txt - SoftFloat Release 2b General Documentation.
-- SoftFloat-source.txt - SoftFloat Release 2b Source Documentation.
-- SoftFloat-history.txt - History of Major Changes to SoftFloat, up to Release 2b.

Release 2b

The current version of SoftFloat is Release 2b (2002 May). Since Release 2a was made available in late 1998, no bugs have been reported aside from minor porting problems. The only changes in this release are updates to the documentation and a clarification of the restrictions on legal use. If you are already using the earlier Release 2a, you should not need to download this release.

The following archives contain all the source code and documentation for Release 2b:
-> zip archive, [115 kB].
-> compress'ed tar archive, SoftFloat-2b.tar.Z [165 kB].

Testing SoftFloat

Once compiled, SoftFloat can be tested using the testsoftfloat program of TestFloat:
[] TestFloat is a program for testing that an implementation of floating-point conforms to the IEC/IEEE Standard for Binary Floating-point Arithmetic.

SoftFloat speed

The following table shows the speeds of some of SoftFloat's functions on machines of different strength. For this table, SoftFloat was compiled using the GNU C Compiler with only ordinary optimization turned on (gcc -O2). Speeds are reported in MFLOPS (millions of floating-point operations per second). Function times are affected by operand values, so your results may vary.

speed (MFLOPS)
single double extended
add mul div add mul div add mul div add mul div
200 MHz Pentium Pro 1.20 1.40 0.88 0.66 0.70 0.33 0.52 0.66 0.19 0.32 0.25 0.13
733 MHz Pentium III 3.61 4.68 2.99 2.77 2.69 1.30 1.82 2.17 0.65 1.29 0.87 0.47

Related sites

[] The fp (floating-point) directory of the Netlib Repository. Includes C subroutines for converting to and from decimal textual formats (e.g., strtod).
[] The Freely Distributable LIBM (fdlibm), an implementation of the C math library (sin, exp, log, etc.), also at the Netlib Repository.
[] Sun Microsystems' Numerical Computation Guide, which covers the IEEE Standard in detail.
[] My article ``Handling floating-point exceptions in numeric programs'', explaining how the exception handling features of the IEEE Standard can be applied to real programs.

Credit and contacts

SoftFloat was written by me, John R. Hauser. The original version of this code was created as part of the Spert project at the International Computer Science Institute. Funding for that project was provided in part by the National Science Foundation under grant MIP-9311980.

Bugs in SoftFloat and other comments can be reported to me at

John Hauser, 2010 June 1