Imported Upstream version 2.9.0
[debian/cc1111] / 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 <sdcc-lib.h>
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 #define EXCESS          126
47 #define SIGNBIT         ((unsigned long)0x80000000)
48 #define HIDDEN          (unsigned long)(1ul << 23)
49 #define SIGN(fp)        (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
50 #define EXP(fp)         (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
51 #define MANT(fp)        (((fp) & (unsigned long)0x007FFFFF) | HIDDEN)
52 #define NORM            0xff000000
53 #define PACK(s,e,m)     ((s) | ((unsigned long)(e) << 23) | (m))
54
55
56 float __uchar2fs (unsigned char) _FS_REENTRANT;
57 float __schar2fs (signed char) _FS_REENTRANT;
58 float __uint2fs (unsigned int) _FS_REENTRANT;
59 float __sint2fs (signed int) _FS_REENTRANT;
60 float __ulong2fs (unsigned long) _FS_REENTRANT;
61 float __slong2fs (signed long) _FS_REENTRANT;
62 unsigned char __fs2uchar (float) _FS_REENTRANT;
63 signed char __fs2schar (float) _FS_REENTRANT;
64 unsigned int __fs2uint (float) _FS_REENTRANT;
65 signed int __fs2sint (float) _FS_REENTRANT;
66 unsigned long __fs2ulong (float) _FS_REENTRANT;
67 signed long __fs2slong (float) _FS_REENTRANT;
68
69 float __fsadd (float, float) _FS_REENTRANT;
70 float __fssub (float, float) _FS_REENTRANT;
71 float __fsmul (float, float) _FS_REENTRANT;
72 float __fsdiv (float, float) _FS_REENTRANT;
73
74 char __fslt (float, float) _FS_REENTRANT;
75 char __fseq (float, float) _FS_REENTRANT;
76 char __fsneq (float, float) _FS_REENTRANT;
77 char __fsgt (float, float) _FS_REENTRANT;
78
79 #endif
80
81
82
83
84