Pull in a bit more data for filtering the start of the boost
[fw/altos] / ao-tools / lib / cmath.h
1 /*
2  * Grace - GRaphing, Advanced Computation and Exploration of data
3  *
4  * Home page: http://plasma-gate.weizmann.ac.il/Grace/
5  *
6  * Copyright (c) 1991-1995 Paul J Turner, Portland, OR
7  * Copyright (c) 1996-2000 Grace Development Team
8  *
9  * Maintained by Evgeny Stambulchik <fnevgeny@plasma-gate.weizmann.ac.il>
10  *
11  *
12  *                           All Rights Reserved
13  *
14  *    This program is free software; you can redistribute it and/or modify
15  *    it under the terms of the GNU General Public License as published by
16  *    the Free Software Foundation; either version 2 of the License, or
17  *    (at your option) any later version.
18  *
19  *    This program is distributed in the hope that it will be useful,
20  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *    GNU General Public License for more details.
23  *
24  *    You should have received a copy of the GNU General Public License
25  *    along with this program; if not, write to the Free Software
26  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28
29 /* cmath.h - replacement for math.h or missing in libm functions */
30
31 #if defined(HAVE_MATH_H)
32 #  include <math.h>
33 #endif
34 #if defined(HAVE_FLOAT_H)
35 #  include <float.h>
36 #endif
37 #if defined(HAVE_IEEEFP_H)
38 #  include <ieeefp.h>
39 #endif
40
41 #ifndef __GRACE_SOURCE_
42
43 #ifndef MACHEP
44 extern double MACHEP;
45 #endif
46
47 #ifndef UFLOWTHRESH
48 extern double UFLOWTHRESH;
49 #endif
50
51 #ifndef MAXNUM
52 extern double MAXNUM;
53 #endif
54
55 #endif /* __GRACE_SOURCE_ */
56
57 #ifndef M_PI
58 #  define M_PI  3.14159265358979323846
59 #endif
60
61 #ifndef M_SQRT2
62 #  define M_SQRT2     1.41421356237309504880      /* sqrt(2) */
63 #endif
64
65 #ifndef M_SQRT1_2
66 #  define M_SQRT1_2   0.70710678118654752440      /* 1/sqrt(2) */
67 #endif
68
69 #ifndef M_SQRT1_3
70 #  define M_SQRT1_3   0.57735026918962576451      /* 1/sqrt(3) */
71 #endif
72
73 #ifndef HAVE_HYPOT
74 #  define hypot(x, y) sqrt((x)*(x) + (y)*(y))
75 #endif
76
77 extern double round ( double x );
78 #ifndef HAVE_RINT
79 #  define rint round
80 #else
81 #  ifndef HAVE_RINT_DECL
82 extern double rint ( double x );
83 #  endif
84 #endif
85
86 #ifndef HAVE_CBRT_DECL
87 extern double cbrt ( double x );
88 #endif
89
90 /* Cygnus gnuwin32 has the log2 macro */
91 #ifdef log2
92 #  undef log2
93 #endif
94
95 #ifndef HAVE_LOG2_DECL
96 extern double log2 ( double x );
97 #endif
98
99 #ifndef HAVE_LGAMMA
100 extern int sgngam;
101 #  define lgamma lgam
102 #  define signgam sgngam
103 extern double lgam ( double x );
104 #else
105 #  ifndef HAVE_LGAMMA_DECL
106 extern double lgamma ( double x );
107 #  endif
108 #  ifndef HAVE_SIGNGAM_DECL
109 extern int signgam;
110 #  endif
111 #  define lgam lgamma
112 #  define sgngam signgam
113 #endif
114
115 #ifndef HAVE_ACOSH_DECL
116 extern double acosh ( double x );
117 #endif
118
119 #ifndef HAVE_ASINH_DECL
120 extern double asinh ( double x );
121 #endif
122
123 #ifndef HAVE_ATANH_DECL
124 extern double atanh ( double x );
125 #endif
126
127 #ifndef HAVE_ERF_DECL
128 extern double erf ( double x );
129 #endif
130
131 #ifndef HAVE_ERFC_DECL
132 extern double erfc ( double x );
133 #endif
134
135 #ifndef HAVE_Y0_DECL
136 extern double y0 ( double x );
137 #endif
138 #ifndef HAVE_Y1_DECL
139 extern double y1 ( double x );
140 #endif
141 #ifndef HAVE_YN_DECL
142 extern double yn ( int n, double x );
143 #endif
144 #ifndef HAVE_J0_DECL
145 extern double j0 ( double x );
146 #endif
147 #ifndef HAVE_J1_DECL
148 extern double j1 ( double x );
149 #endif
150 #ifndef HAVE_JN_DECL
151 extern double jn ( int n, double x );
152 #endif
153
154 /* isfinite is a macro */
155 #ifdef isfinite
156 #  define HAVE_ISFINITE_MACRO
157 #endif
158
159 #ifndef HAVE_FINITE
160 #  define finite isfinite
161 #  if !defined(HAVE_ISFINITE_DECL) && !defined(HAVE_ISFINITE_MACRO)
162 extern int isfinite ( double x );
163 #  endif
164 #else
165 #  ifndef HAVE_FINITE_DECL
166 extern int finite ( double x );
167 #  endif
168 #endif
169
170 #ifndef HAVE_ISNAN_DECL
171 #ifdef __FreeBSD__
172 #  include <sys/param.h>
173 #  if __FreeBSD_version < 500100
174 extern int isnan ( double x );
175 #  endif
176 #endif
177 #else
178 extern int isnan ( double x );
179 #endif