1 | [[tags: egg]] |
---|

2 | |
---|

3 | == Introduction |
---|

4 | |
---|

5 | The {{fpio}} library contains a routines for converting floating-point |
---|

6 | numbers between IEEE binary representation and decimal string |
---|

7 | representation. It is based on the [[http://www.netlib.org/fp/|gdtoa]] |
---|

8 | library by David Gay. |
---|

9 | |
---|

10 | There are two routines included with the library, {{string->fp}} and |
---|

11 | {{fp->string}}. |
---|

12 | |
---|

13 | == Library procedures |
---|

14 | |
---|

15 | === {{fp->string:: NUMBER [* NDIGITS] -> STRING}} |
---|

16 | |
---|

17 | Converts the given floating-point number to decimal string |
---|

18 | representation. If optional argument {{NDIGITS}} is positive, the |
---|

19 | conversion is done to the specified number of decimal places. If |
---|

20 | {{NDIGITS}} is zero (the default) or negative, the conversion is done |
---|

21 | to the shortest decimal string that rounds to the given floating point |
---|

22 | value. |
---|

23 | |
---|

24 | === {{string->fp:: STRING [* ROUNDING] -> NUMBER}} |
---|

25 | |
---|

26 | Converts the given decimal string number to binary IEEE floating point |
---|

27 | representation. Optional argument {{ROUNDING}} is a symbol that can |
---|

28 | be one of: |
---|

29 | |
---|

30 | ; {{toward-zero}} : indicates rounding-towards-zero mode (the default) |
---|

31 | ; {{nearest}} : indicates rounding-towards-nearest mode |
---|

32 | ; {{toward+Inf}} : indicates rounding-towards +Inf mode |
---|

33 | ; {{toward-Inf}} : indicates rounding-towards -Inf mode |
---|

34 | |
---|

35 | |
---|

36 | == Authors |
---|

37 | |
---|

38 | Ivan Raikov |
---|

39 | |
---|

40 | == Version |
---|

41 | |
---|

42 | ; 1.3 : Ported to Chicken 4 |
---|

43 | ; 1.2 : Fixes to the file manifest |
---|

44 | ; 1.0 : Initial version |
---|

45 | |
---|

46 | == License |
---|

47 | |
---|

48 | Copyright 2008 Ivan Raikov. |
---|

49 | |
---|

50 | Permission to use, copy, modify, and distribute this software and its |
---|

51 | documentation for any purpose and without fee is hereby granted, |
---|

52 | provided that the above copyright notice appear in all copies and that |
---|

53 | both that the copyright notice and this permission notice appear in |
---|

54 | supporting documentation. |
---|

55 | |
---|