LibIEEE754 3.2 review

by on

LibIEEE754 is a software implementation of IEEE Standard 754 for Binary Floating-Point Arithmetic. This library is a software impl

License: BSD License
File size: 0K
Developer: Marco
0 stars award from

LibIEEE754 is a software implementation of IEEE Standard 754 for Binary Floating-Point Arithmetic.

This library is a software implementation of the IEEE 754 standard for floating-point data storage. It supports the following data types:

IEEE Single Precision (32-bit)
IEEE Double Precision (64-bit)
IEEE Extended Precision (80-bit) [1]

It should work on both non-IEEE and IEEE FPUs, as well as in soft-float environments, and it should be able to convert between native format and Single, Double and Extended precision standard formats.

It provides functions that can be used from a C application (or even from other languages providing a suitable wrapper).

In example, if your application needs to read and write floating point values to interchange data, you can use the IEEE 754 standard with this library without caring about the floating-point format which the local FPU implements.

It can also be used to test if a FPU uses the IEEE 754 format; or to provide IEEE Extended Precision I/O capabilities in machines whose FPUs only support Single and Double formats.

The Extended Precision Format

The Extended Precision format supported here is the 80-bit version as used on Motorola 68881, Motorola 68882 and Motorola 68040 FPUs, and on Intel 80x87 FPUs.

The library tries to use the larger floating point data type available on the host; so please note that in some machines, although you can read & write 80-bit extended values, you might not be able to extract and use all the precision contained in those values if your FPU doesn't support such a precision.

You need a C compiler and a standard math library to build LibIEEE754. ANSI C support is not required, so old compilers might work.

Building on UNIX / POSIX boxes

On a UNIX-like host you can use the < configure > script to auto-detect the best available data types and compiler features:

% ./configure

Or, if you want to specify a custom prefix to install the library and include files:

% ./configure --prefix=/usr

And then:

% make
# make install

(this last command should be executed with enough permissions to write to the selected prefix)

Using the ieee754test tool

Once you have built the library you will be able to use the ieee754test tool to test the Libieee754 as well as your FPU precision. This program will perform 8 tests for each data type. The tests output will look like this:

IEEE Double Test #3:
Tested value: 1.618033988749890
Returned value: 1.618033988749890
Returned data: 3FF9E3779B97F492
Correct data: 3FF9E3779B97F492

When the returned data is exactly identical to the correct data the available precision is very good.

A correct data is not supplied to the IEEE Extended tests, since the result is likely to vary sightly from one to other FPUs, especially in those which don't support 80-bit of precision.

LibIEEE754 3.2 keywords