?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. /*-------------------------------------------------------------------------
  2.   float.h - ANSI functions forward declarations
  3.  
  4.              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
  5.  
  6.    This program is free software; you can redistribute it and/or modify it
  7.    under the terms of the GNU General Public License as published by the
  8.    Free Software Foundation; either version 2, or (at your option) any
  9.    later version.
  10.  
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19.  
  20.    In other words, you are welcome to use, share and improve this program.
  21.    You are forbidden to forbid anyone else to use, share and improve
  22.    what you give them.   Help stamp out software-hoarding!
  23. -------------------------------------------------------------------------*/
  24.  
  25. #ifndef __SDC51_FLOAT_H
  26. #define __SDC51_FLOAT_H 1
  27.  
  28. #include <limits.h>
  29.  
  30. #define FLT_RADIX       2
  31. #define FLT_MANT_DIG    24
  32. #define FLT_EPSILON     1.192092896E-07F
  33. #define FLT_DIG         6
  34. #define FLT_MIN_EXP     (-125)
  35. #define FLT_MIN         1.175494351E-38F
  36. #define FLT_MIN_10_EXP  (-37)
  37. #define FLT_MAX_EXP     (+128)
  38. #define FLT_MAX         3.402823466E+38F
  39. #define FLT_MAX_10_EXP  (+38)
  40.  
  41. /* the following deal with IEEE single-precision numbers */
  42. #define EXCESS          126
  43. #define SIGNBIT         ((unsigned long)0x80000000)
  44. #define __INFINITY      ((unsigned long)0x7F800000)
  45. #define HIDDEN          (unsigned long)(1ul << 23)
  46. #define SIGN(fp)        (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
  47. #define EXP(fp)         (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
  48. #define MANT(fp)        (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
  49. #define NORM            0xff000000
  50. #define PACK(s,e,m)     ((s) | ((unsigned long)(e) << 23) | (m))
  51.  
  52. float __uchar2fs (unsigned char);
  53. float __schar2fs (signed char);
  54. float __uint2fs (unsigned int);
  55. float __sint2fs (signed int);
  56. float __ulong2fs (unsigned long);
  57. float __slong2fs (signed long);
  58. unsigned char __fs2uchar (float);
  59. signed char __fs2schar (float);
  60. unsigned int __fs2uint (float);
  61. signed int __fs2sint (float);
  62. unsigned long __fs2ulong (float);
  63. signed long __fs2slong (float);
  64.  
  65. float __fsadd (float, float);
  66. float __fssub (float, float);
  67. float __fsmul (float, float);
  68. float __fsdiv (float, float);
  69.  
  70. char __fslt (float, float);
  71. char __fseq (float, float);
  72. char __fsgt (float, float);
  73.  
  74.  
  75. #if defined(SDCC_FLOAT_LIB) && defined(SDCC_mcs51) && !defined(SDCC_USE_XSTACK) && !defined(_SDCC_NO_ASM_LIB_FUNCS)
  76.  
  77. #define FLOAT_ASM_MCS51
  78.  
  79. /* This adds extra code for proper round-off, in
  80.    an attempt to match the results from gcc. */
  81. #define FLOAT_FULL_ACCURACY
  82.  
  83. /* This adds about 66 bytes to the code size and
  84.    significantly speeds up shift operations more
  85.    than 8 bits (common when subtracting numbers
  86.    of significantly different magnitude and scaling
  87.    to fixed point) */
  88. #define FLOAT_SHIFT_SPEEDUP
  89.  
  90. #define sign_a  psw.1
  91. #define sign_b  psw.5
  92. #define exp_a dpl
  93. #define exp_b dph
  94. #endif  /* using mcs51 assembly */
  95.  
  96.  
  97. #endif  /* __SDC51_FLOAT_H */
  98.  
  99.