* initial versions
[fw/sdcc] / device / include / pic16 / float.h
1 /*-------------------------------------------------------------------------
2   float.h - ANSI functions forward declarations
3  
4         Adopted for pic16 port library by Vangelis Rokas
5                 [vrokas at otenet.gr] (2004)
6
7              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
8
9    This program is free software; you can redistribute it and/or modify it
10    under the terms of the GNU General Public License as published by the
11    Free Software Foundation; either version 2, or (at your option) any
12    later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22    
23    In other words, you are welcome to use, share and improve this program.
24    You are forbidden to forbid anyone else to use, share and improve
25    what you give them.   Help stamp out software-hoarding!  
26 -------------------------------------------------------------------------*/
27
28 #ifndef __FLOAT_H
29 #define __FLOAT_H 1
30
31 #include <limits.h>
32
33 #define FLT_RADIX       2
34 #define FLT_MANT_DIG    24
35 #define FLT_EPSILON     1.192092896E-07F
36 #define FLT_DIG         6
37 #define FLT_MIN_EXP     (-125)
38 #define FLT_MIN         1.175494351E-38F
39 #define FLT_MIN_10_EXP  (-37)
40 #define FLT_MAX_EXP     (+128)
41 #define FLT_MAX         3.402823466E+38F
42 #define FLT_MAX_10_EXP  (+38)
43
44 /* the following deal with IEEE single-precision numbers */
45 #define EXCESS          126
46 #define SIGNBIT         ((unsigned long)0x80000000)
47 #define HIDDEN          (unsigned long)(1ul << 23)
48 #define SIGN(fp)        (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
49 #define EXP(fp)         (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
50 #define MANT(fp)        (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
51 #define NORM            0xff000000
52 #define PACK(s,e,m)     ((s) | ((unsigned long)(e) << 23) | (m))
53
54
55 #if 0
56 #define reentrant
57
58 float __uchar2fs (unsigned char) reentrant;
59 float __schar2fs (signed char) reentrant;
60 float __uint2fs (unsigned int) reentrant;
61 float __sint2fs (signed int) reentrant;
62 float __ulong2fs (unsigned long) reentrant;
63 float __slong2fs (signed long) reentrant;
64 unsigned char __fs2uchar (float) reentrant;
65 signed char __fs2schar (float) reentrant;
66 unsigned int __fs2uint (float) reentrant;
67 signed int __fs2sint (float) reentrant;
68 unsigned long __fs2ulong (float) reentrant;
69 signed long __fs2slong (float) reentrant;
70
71 float __fsadd (float, float) reentrant;
72 float __fssub (float, float) reentrant;
73 float __fsmul (float, float) reentrant;
74 float __fsdiv (float, float) reentrant;
75
76 char __fslt (float, float) reentrant;
77 char __fseq (float, float) reentrant;
78 char __fsgt (float, float) reentrant;
79
80 #endif
81
82 #endif
83
84
85
86
87