1 /* math.h: Floating point math function declarations
3 Copyright (C) 2001 Jesus Calvino-Fraga, jesusc@ieee.org
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
19 /* Version 1.0 - Initial release */
24 #define PI 3.1415926536
25 #define TWO_PI 6.2831853071
26 #define HALF_PI 1.5707963268
27 #define QUART_PI 0.7853981634
28 #define iPI 0.3183098862
29 #define iTWO_PI 0.1591549431
30 #define TWO_O_PI 0.6366197724
32 // EPS=B**(-t/2), where B is the radix of the floating-point representation
33 // and there are t base-B digits in the significand. Therefore, for floats
34 // EPS=2**(-12). Also define EPS2=EPS*EPS.
35 #define EPS 244.14062E-6
36 #define EPS2 59.6046E-9
37 #define XMAX 3.402823466E+38
45 /* Functions on the z80 & gbz80 are always reentrant and so the "reentrant" */
46 /* keyword is not defined. */
47 #if defined(SDCC_z80) || defined(SDCC_gbz80)
48 #define _FLOAT_FUNC_REENTRANT
50 #define _FLOAT_FUNC_REENTRANT reentrant
53 /**********************************************
54 * Prototypes for float ANSI C math functions *
55 **********************************************/
57 /* Trigonometric functions */
58 float sinf(const float x) _FLOAT_FUNC_REENTRANT;
59 float cosf(const float x) _FLOAT_FUNC_REENTRANT;
60 float tanf(const float x) _FLOAT_FUNC_REENTRANT;
61 float cotf(const float x) _FLOAT_FUNC_REENTRANT;
62 float asinf(const float x) _FLOAT_FUNC_REENTRANT;
63 float acosf(const float x) _FLOAT_FUNC_REENTRANT;
64 float atanf(const float x) _FLOAT_FUNC_REENTRANT;
65 float atan2f(const float x, const float y);
67 /* Hyperbolic functions */
68 float sinhf(const float x) _FLOAT_FUNC_REENTRANT;
69 float coshf(const float x) _FLOAT_FUNC_REENTRANT;
70 float tanhf(const float x) _FLOAT_FUNC_REENTRANT;
72 /* Exponential, logarithmic and power functions */
73 float expf(const float x);
74 float logf(const float x) _FLOAT_FUNC_REENTRANT;
75 float log10f(const float x) _FLOAT_FUNC_REENTRANT;
76 float powf(const float x, const float y);
77 float sqrtf(const float a) _FLOAT_FUNC_REENTRANT;
79 /* Nearest integer, absolute value, and remainder functions */
80 float fabsf(const float x) _FLOAT_FUNC_REENTRANT;
81 float frexpf(const float x, int *pw2);
82 float ldexpf(const float x, const int pw2);
83 float ceilf(float x) _FLOAT_FUNC_REENTRANT;
84 float floorf(float x) _FLOAT_FUNC_REENTRANT;
85 float modff(float x, float * y);
87 #endif /* _INC_MATH */