float.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*-------------------------------------------------------------------------
  2. float.h - ANSI functions forward declarations
  3. Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
  4. Adopted for pic16 port library by Vangelis Rokas <vrokas AT otenet.gr> (2004)
  5. This library is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by the
  7. Free Software Foundation; either version 2, or (at your option) any
  8. later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this library; see the file COPYING. If not, write to the
  15. Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
  16. MA 02110-1301, USA.
  17. As a special exception, if you link this library with other files,
  18. some of which are compiled with SDCC, to produce an executable,
  19. this library does not by itself cause the resulting executable to
  20. be covered by the GNU General Public License. This exception does
  21. not however invalidate any other reasons why the executable file
  22. might be covered by the GNU General Public License.
  23. -------------------------------------------------------------------------*/
  24. #ifndef __FLOAT_H
  25. #define __FLOAT_H 1
  26. #include <sdcc-lib.h>
  27. #include <limits.h>
  28. #define FLT_RADIX 2
  29. #define FLT_MANT_DIG 24
  30. #define FLT_EPSILON 1.192092896E-07F
  31. #define FLT_DIG 6
  32. #define FLT_MIN_EXP (-125)
  33. #define FLT_MIN 1.175494351E-38F
  34. #define FLT_MIN_10_EXP (-37)
  35. #define FLT_MAX_EXP (+128)
  36. #define FLT_MAX 3.402823466E+38F
  37. #define FLT_MAX_10_EXP (+38)
  38. /* the following deal with IEEE single-precision numbers */
  39. #define EXCESS 126
  40. #define SIGNBIT ((unsigned long)0x80000000)
  41. #define HIDDEN (unsigned long)(1ul << 23)
  42. #define SIGN(fp) (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
  43. #define EXP(fp) (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
  44. #define MANT(fp) (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
  45. #define NORM 0xff000000
  46. #define PACK(s,e,m) ((s) | ((unsigned long)(e) << 23) | (m))
  47. float __uchar2fs (unsigned char) _FS_REENTRANT;
  48. float __schar2fs (signed char) _FS_REENTRANT;
  49. float __uint2fs (unsigned int) _FS_REENTRANT;
  50. float __sint2fs (signed int) _FS_REENTRANT;
  51. float __ulong2fs (unsigned long) _FS_REENTRANT;
  52. float __slong2fs (signed long) _FS_REENTRANT;
  53. unsigned char __fs2uchar (float) _FS_REENTRANT;
  54. signed char __fs2schar (float) _FS_REENTRANT;
  55. unsigned int __fs2uint (float) _FS_REENTRANT;
  56. signed int __fs2sint (float) _FS_REENTRANT;
  57. unsigned long __fs2ulong (float) _FS_REENTRANT;
  58. signed long __fs2slong (float) _FS_REENTRANT;
  59. float __fsadd (float, float) _FS_REENTRANT;
  60. float __fssub (float, float) _FS_REENTRANT;
  61. float __fsmul (float, float) _FS_REENTRANT;
  62. float __fsdiv (float, float) _FS_REENTRANT;
  63. char __fslt (float, float) _FS_REENTRANT;
  64. char __fseq (float, float) _FS_REENTRANT;
  65. char __fsneq (float, float) _FS_REENTRANT;
  66. char __fsgt (float, float) _FS_REENTRANT;
  67. #endif