?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. /*-------------------------------------------------------------------------
  2.    float.h - ANSI functions forward declarations
  3.  
  4.    Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
  5.  
  6.    This library 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 library 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 library; see the file COPYING. If not, write to the
  18.    Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
  19.    MA 02110-1301, USA.
  20.  
  21.    As a special exception, if you link this library with other files,
  22.    some of which are compiled with SDCC, to produce an executable,
  23.    this library does not by itself cause the resulting executable to
  24.    be covered by the GNU General Public License. This exception does
  25.    not however invalidate any other reasons why the executable file
  26.    might be covered by the GNU General Public License.
  27. -------------------------------------------------------------------------*/
  28.  
  29. #ifndef __SDC51_FLOAT_H
  30. #define __SDC51_FLOAT_H 1
  31.  
  32. #include <limits.h>
  33.  
  34. #define FLT_RADIX       2
  35. #define FLT_MANT_DIG    24
  36. #define FLT_EPSILON     1.192092896E-07F
  37. #define FLT_DIG         6
  38. #define FLT_MIN_EXP     (-125)
  39. #define FLT_MIN         1.175494351E-38F
  40. #define FLT_MIN_10_EXP  (-37)
  41. #define FLT_MAX_EXP     (+128)
  42. #define FLT_MAX         3.402823466E+38F
  43. #define FLT_MAX_10_EXP  (+38)
  44.  
  45. /* the following deal with IEEE single-precision numbers */
  46. #if defined(__SDCC_FLOAT_LIB)
  47. #define EXCESS          126
  48. #define SIGNBIT         ((unsigned long)0x80000000)
  49. #define __INFINITY      ((unsigned long)0x7F800000)
  50. #define HIDDEN          (unsigned long)(1ul << 23)
  51. #define SIGN(fp)        (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
  52. #define EXP(fp)         (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
  53. #define MANT(fp)        (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
  54. #define NORM            0xff000000
  55. #define PACK(s,e,m)     ((s) | ((unsigned long)(e) << 23) | (m))
  56. #endif
  57.  
  58. float __uchar2fs (unsigned char);
  59. float __schar2fs (signed char);
  60. float __uint2fs (unsigned int);
  61. float __sint2fs (signed int);
  62. float __ulong2fs (unsigned long);
  63. float __slong2fs (signed long);
  64. unsigned char __fs2uchar (float);
  65. signed char __fs2schar (float);
  66. unsigned int __fs2uint (float);
  67. signed int __fs2sint (float);
  68. unsigned long __fs2ulong (float);
  69. signed long __fs2slong (float);
  70.  
  71. float __fsadd (float, float);
  72. float __fssub (float, float);
  73. float __fsmul (float, float);
  74. float __fsdiv (float, float);
  75.  
  76. char __fslt (float, float);
  77. char __fseq (float, float);
  78. char __fsgt (float, float);
  79.  
  80.  
  81. #if defined(__SDCC_FLOAT_LIB) && defined(__SDCC_mcs51) && !defined(__SDCC_USE_XSTACK) && !defined(_SDCC_NO_ASM_LIB_FUNCS)
  82.  
  83. #define FLOAT_ASM_MCS51
  84.  
  85. /* This adds extra code for proper round-off, in
  86.    an attempt to match the results from gcc. */
  87. #define FLOAT_FULL_ACCURACY
  88.  
  89. /* This adds about 66 bytes to the code size and
  90.    significantly speeds up shift operations more
  91.    than 8 bits (common when subtracting numbers
  92.    of significantly different magnitude and scaling
  93.    to fixed point) */
  94. #define FLOAT_SHIFT_SPEEDUP
  95.  
  96. #define sign_a  psw.1
  97. #define sign_b  psw.5
  98. #define exp_a dpl
  99. #define exp_b dph
  100. #endif  /* using mcs51 assembly */
  101.  
  102.  
  103. #endif  /* __SDC51_FLOAT_H */
  104.  
  105.