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