1 | //
|
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
---|
3 | //
|
---|
4 | // The contents of this file are covered under the licence agreement in the
|
---|
5 | // file "LICENCE" distributed with Cforall.
|
---|
6 | //
|
---|
7 | // math --
|
---|
8 | //
|
---|
9 | // Author : Peter A. Buhr
|
---|
10 | // Created On : Mon Apr 18 23:37:04 2016
|
---|
11 | // Last Modified By : Peter A. Buhr
|
---|
12 | // Last Modified On : Sun Apr 24 12:45:02 2016
|
---|
13 | // Update Count : 59
|
---|
14 | //
|
---|
15 |
|
---|
16 | #ifdef __CFORALL__
|
---|
17 |
|
---|
18 | #ifndef MATH_H
|
---|
19 | #define MATH_H
|
---|
20 |
|
---|
21 | extern "C" {
|
---|
22 | #include <math.h> // fpclassify, isfinite, isnormal, isnan, isinf
|
---|
23 | } // extern "C"
|
---|
24 |
|
---|
25 | float fabs( float );
|
---|
26 | // extern "C" { double fabs( double ); }
|
---|
27 | long double fabs( long double );
|
---|
28 | float cabs( float _Complex );
|
---|
29 | // extern "C" { double cabs( double _Complex ); }
|
---|
30 | long double cabs( long double _Complex );
|
---|
31 |
|
---|
32 | float ?%?( float, float );
|
---|
33 | float fmod( float, float );
|
---|
34 | double ?%?( double, double );
|
---|
35 | // extern "C" { double fmod( double, double ); }
|
---|
36 | long double ?%?( long double, long double );
|
---|
37 | long double fmod( long double, long double );
|
---|
38 |
|
---|
39 | float remainder( float, float );
|
---|
40 | // extern "C" { double remainder( double, double ); }
|
---|
41 | long double remainder( long double, long double );
|
---|
42 |
|
---|
43 | [ int, float ] remquo( float, float );
|
---|
44 | float remquo( float, float, int * );
|
---|
45 | [ int, double ] remquo( double, double );
|
---|
46 | // extern "C" { double remquo( double, double, int * ); }
|
---|
47 | [ int, long double ] remquo( long double, long double );
|
---|
48 | long double remquo( long double, long double, int * );
|
---|
49 |
|
---|
50 | [ int, float ] div( float, float ); // alternative name for remquo
|
---|
51 | float div( float, float, int * );
|
---|
52 | [ int, double ] div( double, double );
|
---|
53 | // extern "C" { double div( double, double, int * ); }
|
---|
54 | [ int, long double ] div( long double, long double );
|
---|
55 | long double div( long double, long double, int * );
|
---|
56 |
|
---|
57 | float fma( float, float, float );
|
---|
58 | // extern "C" { double fma( double, double, double ); }
|
---|
59 | long double fma( long double, long double, long double );
|
---|
60 |
|
---|
61 | float fdim( float, float );
|
---|
62 | // extern "C" { double fdim( double, double ); }
|
---|
63 | long double fdim( long double, long double );
|
---|
64 |
|
---|
65 | float nan( const char * );
|
---|
66 | // extern "C" { double nan( const char * ); }
|
---|
67 | long double nan( const char * );
|
---|
68 |
|
---|
69 | //---------------------- Exponential ----------------------
|
---|
70 |
|
---|
71 | float exp( float );
|
---|
72 | // extern "C" { double exp( double ); }
|
---|
73 | long double exp( long double );
|
---|
74 | float _Complex exp( float _Complex );
|
---|
75 | double _Complex exp( double _Complex );
|
---|
76 | long double _Complex exp( long double _Complex );
|
---|
77 |
|
---|
78 | float exp2( float );
|
---|
79 | // extern "C" { double exp2( double ); }
|
---|
80 | long double exp2( long double );
|
---|
81 | // float _Complex exp2( float _Complex );
|
---|
82 | // double _Complex exp2( double _Complex );
|
---|
83 | // long double _Complex exp2( long double _Complex );
|
---|
84 |
|
---|
85 | float expm1( float );
|
---|
86 | // extern "C" { double expm1( double ); }
|
---|
87 | long double expm1( long double );
|
---|
88 |
|
---|
89 | float log( float );
|
---|
90 | // extern "C" { double log( double ); }
|
---|
91 | long double log( long double );
|
---|
92 | float _Complex log( float _Complex );
|
---|
93 | double _Complex log( double _Complex );
|
---|
94 | long double _Complex log( long double _Complex );
|
---|
95 |
|
---|
96 | float log2( float );
|
---|
97 | // extern "C" { double log2( double ); }
|
---|
98 | long double log2( long double );
|
---|
99 | // float _Complex log2( float _Complex );
|
---|
100 | // double _Complex log2( double _Complex );
|
---|
101 | // long double _Complex log2( long double _Complex );
|
---|
102 |
|
---|
103 | float log10( float );
|
---|
104 | // extern "C" { double log10( double ); }
|
---|
105 | long double log10( long double );
|
---|
106 | // float _Complex log10( float _Complex );
|
---|
107 | // double _Complex log10( double _Complex );
|
---|
108 | // long double _Complex log10( long double _Complex );
|
---|
109 |
|
---|
110 | float log1p( float );
|
---|
111 | // extern "C" { double log1p( double ); }
|
---|
112 | long double log1p( long double );
|
---|
113 |
|
---|
114 | int ilogb( float );
|
---|
115 | // extern "C" { int ilogb( double ); }
|
---|
116 | int ilogb( long double );
|
---|
117 |
|
---|
118 | float logb( float );
|
---|
119 | // extern "C" { double logb( double ); }
|
---|
120 | long double logb( long double );
|
---|
121 |
|
---|
122 | //---------------------- Power ----------------------
|
---|
123 |
|
---|
124 | float sqrt( float );
|
---|
125 | // extern "C" { double sqrt( double ); }
|
---|
126 | long double sqrt( long double );
|
---|
127 | float _Complex sqrt( float _Complex );
|
---|
128 | double _Complex sqrt( double _Complex );
|
---|
129 | long double _Complex sqrt( long double _Complex );
|
---|
130 |
|
---|
131 | float cbrt( float );
|
---|
132 | // extern "C" { double cbrt( double ); }
|
---|
133 | long double cbrt( long double );
|
---|
134 |
|
---|
135 | float hypot( float, float );
|
---|
136 | // extern "C" { double hypot( double, double ); }
|
---|
137 | long double hypot( long double, long double );
|
---|
138 |
|
---|
139 | float pow( float, float );
|
---|
140 | // extern "C" { double pow( double, double ); }
|
---|
141 | long double pow( long double, long double );
|
---|
142 | float _Complex pow( float _Complex, float _Complex );
|
---|
143 | double _Complex pow( double _Complex, double _Complex );
|
---|
144 | long double _Complex pow( long double _Complex, long double _Complex );
|
---|
145 |
|
---|
146 | //---------------------- Trigonometric ----------------------
|
---|
147 |
|
---|
148 | float sin( float );
|
---|
149 | // extern "C" { double sin( double ); }
|
---|
150 | long double sin( long double );
|
---|
151 | float _Complex sin( float _Complex );
|
---|
152 | double _Complex sin( double _Complex );
|
---|
153 | long double _Complex sin( long double _Complex );
|
---|
154 |
|
---|
155 | float cos( float );
|
---|
156 | // extern "C" { double cos( double ); }
|
---|
157 | long double cos( long double );
|
---|
158 | float _Complex cos( float _Complex );
|
---|
159 | double _Complex cos( double _Complex );
|
---|
160 | long double _Complex cos( long double _Complex );
|
---|
161 |
|
---|
162 | float tan( float );
|
---|
163 | // extern "C" { double tan( double ); }
|
---|
164 | long double tan( long double );
|
---|
165 | float _Complex tan( float _Complex );
|
---|
166 | double _Complex tan( double _Complex );
|
---|
167 | long double _Complex tan( long double _Complex );
|
---|
168 |
|
---|
169 | float asin( float );
|
---|
170 | // extern "C" { double asin( double ); }
|
---|
171 | long double asin( long double );
|
---|
172 | float _Complex asin( float _Complex );
|
---|
173 | double _Complex asin( double _Complex );
|
---|
174 | long double _Complex asin( long double _Complex );
|
---|
175 |
|
---|
176 | float acos( float );
|
---|
177 | // extern "C" { double acos( double ); }
|
---|
178 | long double acos( long double );
|
---|
179 | float _Complex acos( float _Complex );
|
---|
180 | double _Complex acos( double _Complex );
|
---|
181 | long double _Complex acos( long double _Complex );
|
---|
182 |
|
---|
183 | float atan( float );
|
---|
184 | // extern "C" { double atan( double ); }
|
---|
185 | long double atan( long double );
|
---|
186 | float _Complex atan( float _Complex );
|
---|
187 | double _Complex atan( double _Complex );
|
---|
188 | long double _Complex atan( long double _Complex );
|
---|
189 |
|
---|
190 | float atan2( float, float );
|
---|
191 | // extern "C" { double atan2( double, double ); }
|
---|
192 | long double atan2( long double, long double );
|
---|
193 |
|
---|
194 | float atan( float, float ); // alternative name for atan2
|
---|
195 | double atan( double, double );
|
---|
196 | long double atan( long double, long double );
|
---|
197 |
|
---|
198 | //---------------------- Hyperbolic ----------------------
|
---|
199 |
|
---|
200 | float sinh( float );
|
---|
201 | // extern "C" { double sinh( double ); }
|
---|
202 | long double sinh( long double );
|
---|
203 | float _Complex sinh( float _Complex );
|
---|
204 | double _Complex sinh( double _Complex );
|
---|
205 | long double _Complex sinh( long double _Complex );
|
---|
206 |
|
---|
207 | float cosh( float );
|
---|
208 | // extern "C" { double cosh( double ); }
|
---|
209 | long double cosh( long double );
|
---|
210 | float _Complex cosh( float _Complex );
|
---|
211 | double _Complex cosh( double _Complex );
|
---|
212 | long double _Complex cosh( long double _Complex );
|
---|
213 |
|
---|
214 | float tanh( float );
|
---|
215 | // extern "C" { double tanh( double ); }
|
---|
216 | long double tanh( long double );
|
---|
217 | float _Complex tanh( float _Complex );
|
---|
218 | double _Complex tanh( double _Complex );
|
---|
219 | long double _Complex tanh( long double _Complex );
|
---|
220 |
|
---|
221 | float asinh( float );
|
---|
222 | // extern "C" { double asinh( double ); }
|
---|
223 | long double asinh( long double );
|
---|
224 | float _Complex asinh( float _Complex );
|
---|
225 | double _Complex asinh( double _Complex );
|
---|
226 | long double _Complex asinh( long double _Complex );
|
---|
227 |
|
---|
228 | float acosh( float );
|
---|
229 | // extern "C" { double acosh( double ); }
|
---|
230 | long double acosh( long double );
|
---|
231 | float _Complex acosh( float _Complex );
|
---|
232 | double _Complex acosh( double _Complex );
|
---|
233 | long double _Complex acosh( long double _Complex );
|
---|
234 |
|
---|
235 | float atanh( float );
|
---|
236 | // extern "C" { double atanh( double ); }
|
---|
237 | long double atanh( long double );
|
---|
238 | float _Complex atanh( float _Complex );
|
---|
239 | double _Complex atanh( double _Complex );
|
---|
240 | long double _Complex atanh( long double _Complex );
|
---|
241 |
|
---|
242 | //---------------------- Error / Gamma ----------------------
|
---|
243 |
|
---|
244 | float erf( float );
|
---|
245 | // extern "C" { double erf( double ); }
|
---|
246 | long double erf( long double );
|
---|
247 | // float _Complex erf( float _Complex );
|
---|
248 | // double _Complex erf( double _Complex );
|
---|
249 | // long double _Complex erf( long double _Complex );
|
---|
250 |
|
---|
251 | float erfc( float );
|
---|
252 | // extern "C" { double erfc( double ); }
|
---|
253 | long double erfc( long double );
|
---|
254 | // float _Complex erfc( float _Complex );
|
---|
255 | // double _Complex erfc( double _Complex );
|
---|
256 | // long double _Complex erfc( long double _Complex );
|
---|
257 |
|
---|
258 | float lgamma( float );
|
---|
259 | // extern "C" { double lgamma( double ); }
|
---|
260 | long double lgamma( long double );
|
---|
261 | float lgamma( float, int * );
|
---|
262 | double lgamma( double, int * );
|
---|
263 | long double lgamma( long double, int * );
|
---|
264 |
|
---|
265 | float tgamma( float );
|
---|
266 | // extern "C" { double tgamma( double ); }
|
---|
267 | long double tgamma( long double );
|
---|
268 |
|
---|
269 | //---------------------- Nearest Integer ----------------------
|
---|
270 |
|
---|
271 | float floor( float );
|
---|
272 | // extern "C" { double floor( double ); }
|
---|
273 | long double floor( long double );
|
---|
274 |
|
---|
275 | float ceil( float );
|
---|
276 | // extern "C" { double ceil( double ); }
|
---|
277 | long double ceil( long double );
|
---|
278 |
|
---|
279 | float trunc( float );
|
---|
280 | // extern "C" { double trunc( double ); }
|
---|
281 | long double trunc( long double );
|
---|
282 |
|
---|
283 | float rint( float );
|
---|
284 | long double rint( long double );
|
---|
285 | long int rint( float );
|
---|
286 | long int rint( double );
|
---|
287 | long int rint( long double );
|
---|
288 | long long int rint( float );
|
---|
289 | long long int rint( double );
|
---|
290 | long long int rint( long double );
|
---|
291 |
|
---|
292 | long int lrint( float );
|
---|
293 | // extern "C" { long int lrint( double ); }
|
---|
294 | long int lrint( long double );
|
---|
295 | long long int llrint( float );
|
---|
296 | // extern "C" { long long int llrint( double ); }
|
---|
297 | long long int llrint( long double );
|
---|
298 |
|
---|
299 | float nearbyint( float );
|
---|
300 | // extern "C" { double nearbyint( double ); }
|
---|
301 | long double nearbyint( long double );
|
---|
302 |
|
---|
303 | float round( float );
|
---|
304 | long double round( long double );
|
---|
305 | long int round( float );
|
---|
306 | long int round( double );
|
---|
307 | long int round( long double );
|
---|
308 | long long int round( float );
|
---|
309 | long long int round( double );
|
---|
310 | long long int round( long double );
|
---|
311 |
|
---|
312 | long int lround( float );
|
---|
313 | // extern "C" { long int lround( double ); }
|
---|
314 | long int lround( long double );
|
---|
315 | long long int llround( float );
|
---|
316 | // extern "C" { long long int llround( double ); }
|
---|
317 | long long int llround( long double );
|
---|
318 |
|
---|
319 | //---------------------- Manipulation ----------------------
|
---|
320 |
|
---|
321 | float copysign( float, float );
|
---|
322 | // extern "C" { double copysign( double, double ); }
|
---|
323 | long double copysign( long double, long double );
|
---|
324 |
|
---|
325 | float frexp( float, int * );
|
---|
326 | // extern "C" { double frexp( double, int * ); }
|
---|
327 | long double frexp( long double, int * );
|
---|
328 |
|
---|
329 | float ldexp( float, int );
|
---|
330 | // extern "C" { double ldexp( double, int ); }
|
---|
331 | long double ldexp( long double, int );
|
---|
332 |
|
---|
333 | [ float, float ] modf( float );
|
---|
334 | float modf( float, float * );
|
---|
335 | [ double, double ] modf( double );
|
---|
336 | // extern "C" { double modf( double, double * ); }
|
---|
337 | [ long double, long double ] modf( long double );
|
---|
338 | long double modf( long double, long double * );
|
---|
339 |
|
---|
340 | float nextafter( float, float );
|
---|
341 | // extern "C" { double nextafter( double, double ); }
|
---|
342 | long double nextafter( long double, long double );
|
---|
343 |
|
---|
344 | float nexttoward( float, long double );
|
---|
345 | // extern "C" { double nexttoward( double, long double ); }
|
---|
346 | long double nexttoward( long double, long double );
|
---|
347 |
|
---|
348 | float scalbn( float, int );
|
---|
349 | // extern "C" { double scalbn( double, int ); }
|
---|
350 | long double scalbn( long double, int );
|
---|
351 |
|
---|
352 | float scalbln( float, long int );
|
---|
353 | // extern "C" { double scalbln( double, long int ); }
|
---|
354 | long double scalbln( long double, long int );
|
---|
355 |
|
---|
356 | #endif // MATH_H
|
---|
357 |
|
---|
358 | #else
|
---|
359 | #include_next <math>
|
---|
360 | #endif //__CFORALL__
|
---|
361 |
|
---|
362 | // Local Variables: //
|
---|
363 | // mode: c //
|
---|
364 | // tab-width: 4 //
|
---|
365 | // End: //
|
---|