328fccd89615195e043b7b8d75dcfb807da30146
[fw/sdcc] / device / include / float.h
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 HIDDEN          (unsigned long)(1 << 23)
45 #define SIGN(fp)        ((fp >> (8*sizeof(fp)-1)) & 1)
46 #define EXP(fp)         (((fp) >> 23) & (unsigned int) 0x00FF)
47 #define MANT(fp)        (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
48 #define NORM            0xff000000
49 #define PACK(s,e,m)     ((s) | ((e) << 23) | (m))
50
51 float _uchar2fs (unsigned char);
52 float _schar2fs (signed char);
53 float _uint2fs (unsigned int);
54 float _sint2fs (signed int);
55 float _ulong2fs (unsigned long);
56 float _slong2fs (signed long);
57 unsigned char _fs2uchar (float);
58 signed char _fs2schar (float);
59 unsigned int _fs2uint (float);
60 signed int _fs2sint (float);
61 unsigned long _fs2ulong (float);
62 signed long _fs2slong (float);
63
64 float _fsadd (float, float);
65 float _fssub (float, float);
66 float _fsmul (float, float);
67 float _fsdiv (float, float);
68
69 char _fslt (float, float);
70 char _fseq (float, float);
71 char _fsqt (float, float);
72
73 #endif
74
75
76
77
78