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