Note: This is taken from the Chicken Wiki, where a more recent version could be available.


The fpio library contains a routines for converting floating-point numbers between IEEE binary representation and decimal string representation. It is based on the gdtoa library by David Gay.

There are two routines included with the library, string->fp and fp->string.

Library procedures

fp->string:: NUMBER [* NDIGITS] -> STRING

Converts the given floating-point number to decimal string representation. If optional argument NDIGITS is positive, the conversion is done to the specified number of decimal places. If NDIGITS is zero (the default) or negative, the conversion is done to the shortest decimal string that rounds to the given floating point value.

string->fp:: STRING [* ROUNDING] -> NUMBER

Converts the given decimal string number to binary IEEE floating point representation. Optional argument ROUNDING is a symbol that can be one of:

indicates rounding-towards-zero mode (the default)
indicates rounding-towards-nearest mode
indicates rounding-towards +Inf mode
indicates rounding-towards -Inf mode


Ivan Raikov


Fixes to the file manifest
Initial version


Copyright 2008 Ivan Raikov.

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice appear in supporting documentation.