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