2 * Grace - GRaphing, Advanced Computation and Exploration of data
4 * Home page: http://plasma-gate.weizmann.ac.il/Grace/
6 * Copyright (c) 1991-1995 Paul J Turner, Portland, OR
7 * Copyright (c) 1996-2000 Grace Development Team
9 * Maintained by Evgeny Stambulchik <fnevgeny@plasma-gate.weizmann.ac.il>
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.
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.
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.
29 /* cmath.h - replacement for math.h or missing in libm functions */
31 #if defined(HAVE_MATH_H)
34 #if defined(HAVE_FLOAT_H)
37 #if defined(HAVE_IEEEFP_H)
41 #ifndef __GRACE_SOURCE_
48 extern double UFLOWTHRESH;
55 #endif /* __GRACE_SOURCE_ */
58 # define M_PI 3.14159265358979323846
62 # define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
66 # define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
70 # define M_SQRT1_3 0.57735026918962576451 /* 1/sqrt(3) */
74 # define hypot(x, y) sqrt((x)*(x) + (y)*(y))
77 extern double round ( double x );
81 # ifndef HAVE_RINT_DECL
82 extern double rint ( double x );
86 #ifndef HAVE_CBRT_DECL
87 extern double cbrt ( double x );
90 /* Cygnus gnuwin32 has the log2 macro */
95 #ifndef HAVE_LOG2_DECL
96 extern double log2 ( double x );
102 # define signgam sgngam
103 extern double lgam ( double x );
105 # ifndef HAVE_LGAMMA_DECL
106 extern double lgamma ( double x );
108 # ifndef HAVE_SIGNGAM_DECL
112 # define sgngam signgam
115 #ifndef HAVE_ACOSH_DECL
116 extern double acosh ( double x );
119 #ifndef HAVE_ASINH_DECL
120 extern double asinh ( double x );
123 #ifndef HAVE_ATANH_DECL
124 extern double atanh ( double x );
127 #ifndef HAVE_ERF_DECL
128 extern double erf ( double x );
131 #ifndef HAVE_ERFC_DECL
132 extern double erfc ( double x );
136 extern double y0 ( double x );
139 extern double y1 ( double x );
142 extern double yn ( int n, double x );
145 extern double j0 ( double x );
148 extern double j1 ( double x );
151 extern double jn ( int n, double x );
154 /* isfinite is a macro */
156 # define HAVE_ISFINITE_MACRO
160 # define finite isfinite
161 # if !defined(HAVE_ISFINITE_DECL) && !defined(HAVE_ISFINITE_MACRO)
162 extern int isfinite ( double x );
165 # ifndef HAVE_FINITE_DECL
166 extern int finite ( double x );
170 #ifndef HAVE_ISNAN_DECL
172 # include <sys/param.h>
173 # if __FreeBSD_version < 500100
174 extern int isnan ( double x );
178 extern int isnan ( double x );