((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/fpio" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "fpio" (p "Conversion of floating point numbers between binary and decimal representation.") (toc) (section 3 "Introduction" (p "The " (tt "fpio") " library contains a routines for converting floating-point numbers between IEEE binary representation and decimal string representation. It is based on the " (link "http://www.netlib.org/fp/" "gdtoa") " library by David Gay.") (p "There are two routines included with the library, " (tt "string->fp") " and " (tt "fp->string") ".")) (section 3 "Library procedures" (def (sig (procedure "fp->string:: NUMBER [* NDIGITS] -> STRING" (id fp->string))) (p "Converts the given floating-point number to decimal string representation.  If optional argument " (tt "NDIGITS") " is positive, the conversion is done to the specified number of decimal places. If " (tt "NDIGITS") " is zero (the default) or negative, the conversion is done to the shortest decimal string that rounds to the given floating point value.")) (def (sig (procedure "string->fp:: STRING [* ROUNDING] -> NUMBER" (id string->fp))) (p "Converts the given decimal string number to binary IEEE floating point representation.  Optional argument " (tt "ROUNDING") " is a symbol that can be one of:") (dl (dt (tt "toward-zero")) (dd "indicates rounding-towards-zero mode (the default)") (dt (tt "nearest")) (dd "indicates rounding-towards-nearest mode ") (dt (tt "toward+Inf")) (dd "indicates rounding-towards +Inf mode ") (dt (tt "toward-Inf")) (dd "indicates rounding-towards -Inf mode ")))) (section 3 "Authors" (p (int-link "/users/ivan-raikov" "Ivan Raikov"))) (section 3 "Version" (dl (dt "1.5") (dd "Use -fPIC flag to compile [thanks to Panos Stergiotis]") (dt "1.4") (dd "Added import of foreign library [thanks to felix]") (dt "1.3") (dd "Ported to Chicken 4") (dt "1.2") (dd "Fixes to the file manifest") (dt "1.0") (dd "Initial version"))) (section 3 "License" (p "Copyright 2008-2011 Ivan Raikov.") (pre "Redistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n- Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n- Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following\ndisclaimer in the documentation and/or other materials provided\nwith the distribution.\n\n- Neither name of the copyright holders nor the names of its\ncontributors may be used to endorse or promote products derived\nfrom this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE\nCONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\nINCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR THE\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\nUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\nAND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE."))))