Imported Upstream version 2.9.0
[debian/cc1111] / device / include / pic16 / math.h
1 /*-------------------------------------------------------------------------
2    math.h: Floating point math function declarations
3
4     Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
5     
6     Copyright (C) 2001  Jesus Calvino-Fraga, jesusc@ieee.org 
7
8     This library is free software; you can redistribute it and/or
9     modify it under the terms of the GNU Lesser General Public
10     License as published by the Free Software Foundation; either
11     version 2.1 of the License, or (at your option) any later version.
12
13     This library is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16     Lesser General Public License for more details.
17
18     You should have received a copy of the GNU Lesser General Public
19     License along with this library; if not, write to the Free Software
20     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 -------------------------------------------------------------------------*/
22
23 /*
24 ** $Id: math.h 3648 2005-01-22 18:02:16Z vrokas $
25 */
26
27
28 #ifndef __PIC16_MATH_H
29 #define __PIC16_MATH_H  1
30
31 #pragma library math
32
33 #include <sdcc-lib.h>
34
35 #define PI          3.1415926536
36 #define TWO_PI      6.2831853071
37 #define HALF_PI     1.5707963268
38 #define QUART_PI    0.7853981634
39 #define iPI         0.3183098862
40 #define iTWO_PI     0.1591549431
41 #define TWO_O_PI    0.6366197724
42
43 // EPS=B**(-t/2), where B is the radix of the floating-point representation
44 // and there are t base-B digits in the significand.  Therefore, for floats
45 // EPS=2**(-12).  Also define EPS2=EPS*EPS.
46 #define EPS 244.14062E-6
47 #define EPS2 59.6046E-9
48 #define XMAX 3.402823466E+38
49
50 union float_long
51 {
52     float f;
53     long l;
54 };
55
56 /**********************************************
57  * Prototypes for float ANSI C math functions *
58  **********************************************/
59
60 /* Trigonometric functions */
61 float sinf(const float x) _MATH_REENTRANT;
62 float cosf(const float x) _MATH_REENTRANT;
63 float tanf(const float x) _MATH_REENTRANT;
64 float cotf(const float x) _MATH_REENTRANT;
65 float asinf(const float x) _MATH_REENTRANT;
66 float acosf(const float x) _MATH_REENTRANT;
67 float atanf(const float x) _MATH_REENTRANT;
68 float atan2f(const float x, const float y);
69
70 /* Hyperbolic functions */
71 float sinhf(const float x) _MATH_REENTRANT;
72 float coshf(const float x) _MATH_REENTRANT;
73 float tanhf(const float x) _MATH_REENTRANT;
74
75 /* Exponential, logarithmic and power functions */
76 float expf(const float x);
77 float logf(const float x) _MATH_REENTRANT;
78 float log10f(const float x) _MATH_REENTRANT;
79 float powf(const float x, const float y);
80 float sqrtf(const float a) _MATH_REENTRANT;
81
82 /* Nearest integer, absolute value, and remainder functions */
83 float fabsf(const float x) _MATH_REENTRANT;
84 float frexpf(const float x, int *pw2);
85 float ldexpf(const float x, const int pw2);
86 float ceilf(float x) _MATH_REENTRANT;
87 float floorf(float x) _MATH_REENTRANT;
88 float modff(float x, float * y);
89
90 #endif  /* _PIC16_MATH_H */