summaryrefslogtreecommitdiff
path: root/tests/test-math-c++.cc
blob: 7653d6288c3730647b3e573e6463d9cab17dd1af (plain)
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
/* Test of <math.h> substitute in C++ mode.
   Copyright (C) 2010-2013 Free Software Foundation, Inc.

   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 3 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, see <http://www.gnu.org/licenses/>.  */

/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */

#define GNULIB_NAMESPACE gnulib
#include <config.h>

#include <math.h>

#include "signature.h"

/* Signature check for a function that takes a real-floating argument.
   Check that each overloaded function with the specified signature exists.  */
#define REAL_FLOATING_CHECK(func,\
                            rettype1, parameters1,\
                            rettype2, parameters2,\
                            rettype3, parameters3) \
  OVERLOADED_CHECK (func, rettype1, parameters1, _1); \
  OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
  OVERLOADED_CHECK (func, rettype3, parameters3, _3)
#define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
  static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \
    = static_cast<rettype(*)parameters>(func)


/* Keep these checks in the same order as math.in.h!  */

#if GNULIB_TEST_ACOSF
SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
#if GNULIB_TEST_ACOSL
SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl, long double, (long double));
#endif

#if GNULIB_TEST_ASINF
SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
#if GNULIB_TEST_ASINL
SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl, long double, (long double));
#endif

#if GNULIB_TEST_ATANF
SIGNATURE_CHECK (GNULIB_NAMESPACE::atanf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
#if GNULIB_TEST_ATANL
SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl, long double, (long double));
#endif

#if GNULIB_TEST_ATAN2F
SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f, float, (float, float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));

#if GNULIB_TEST_CBRTF
SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtf, float, (float));
#endif
#if GNULIB_TEST_CBRT
SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
#endif
#if GNULIB_TEST_CBRTL
SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtl, long double, (long double));
#endif

#if GNULIB_TEST_CEILF
SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
#endif
#if GNULIB_TEST_CEIL
SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double));
#endif
#if GNULIB_TEST_CEILL
SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
#endif

#if GNULIB_TEST_COPYSIGNF
SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float));
#endif
#if GNULIB_TEST_COPYSIGN
SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
#endif
#if GNULIB_TEST_COPYSIGNL
SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double,
                 (long double, long double));
#endif

#if GNULIB_TEST_COSF
SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
#if GNULIB_TEST_COSL
SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
#endif

#if GNULIB_TEST_COSHF
SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));

//SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));

//SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));

#if GNULIB_TEST_EXPF
SIGNATURE_CHECK (GNULIB_NAMESPACE::expf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
#if GNULIB_TEST_EXPL
SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
#endif

#if GNULIB_TEST_EXP2F
SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2f, float, (float));
#endif
#if GNULIB_TEST_EXP2
SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2, double, (double));
#endif
#if GNULIB_TEST_EXP2L
SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2l, long double, (long double));
#endif

#if GNULIB_TEST_EXPM1F
SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1f, float, (float));
#endif
#if GNULIB_TEST_EXPM1
SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1, double, (double));
#endif
#if GNULIB_TEST_EXPM1L
SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1l, long double, (long double));
#endif

#if GNULIB_TEST_FABSF
SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
#if GNULIB_TEST_FABSL
SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsl, long double, (long double));
#endif

#if GNULIB_TEST_FLOORF
SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
#endif
#if GNULIB_TEST_FLOOR
SIGNATURE_CHECK (GNULIB_NAMESPACE::floor, double, (double));
#endif
#if GNULIB_TEST_FLOORL
SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
#endif

#if GNULIB_TEST_FMODF
SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
#endif
#if GNULIB_TEST_FMOD
SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
#endif
#if GNULIB_TEST_FMODL
SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl, long double,
                 (long double, long double));
#endif

#if GNULIB_TEST_FREXPF
SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
#endif
#if GNULIB_TEST_FREXP
SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
#endif
#if GNULIB_TEST_FREXPL
SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
#endif

#if GNULIB_TEST_HYPOTF
SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotf, float, (float, float));
#endif
#if GNULIB_TEST_HYPOT
SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
#endif
#if GNULIB_TEST_HYPOTL
SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotl, long double,
                 (long double, long double));
#endif

#if GNULIB_TEST_ILOGBF
SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbf, int, (float));
#endif
#if GNULIB_TEST_ILOGB
SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogb, int, (double));
#endif
#if GNULIB_TEST_ILOGBL
SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbl, int, (long double));
#endif

//SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));

//SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));

//SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));

#if GNULIB_TEST_LDEXPF
SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
#if GNULIB_TEST_LDEXPL
SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
#endif

//SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));

#if GNULIB_TEST_LOG10
SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
#endif
#if GNULIB_TEST_LOG10L
SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l, long double, (long double));
#endif

#if GNULIB_TEST_LOG1PF
SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pf, float, (float));
#endif
#if GNULIB_TEST_LOG1P
SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
#endif
#if GNULIB_TEST_LOG1PL
SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pl, long double, (long double));
#endif

#if GNULIB_TEST_LOGF
SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
#endif
#if GNULIB_TEST_LOG
SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
#endif
#if GNULIB_TEST_LOGL
SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
#endif

#if GNULIB_TEST_LOG10F
SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
#endif

#if GNULIB_TEST_LOG2F
SIGNATURE_CHECK (GNULIB_NAMESPACE::log2f, float, (float));
#endif
#if GNULIB_TEST_LOG2
SIGNATURE_CHECK (GNULIB_NAMESPACE::log2, double, (double));
#endif
#if GNULIB_TEST_LOG2L
SIGNATURE_CHECK (GNULIB_NAMESPACE::log2l, long double, (long double));
#endif

#if GNULIB_TEST_LOGBF
SIGNATURE_CHECK (GNULIB_NAMESPACE::logbf, float, (float));
#endif
#if GNULIB_TEST_LOGB
SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
#endif
#if GNULIB_TEST_LOGBL
SIGNATURE_CHECK (GNULIB_NAMESPACE::logbl, long double, (long double));
#endif

#if GNULIB_TEST_MODFF
SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
#endif
#if GNULIB_TEST_MODF
SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
#endif
#if GNULIB_TEST_MODFL
SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl, long double,
                 (long double, long double *));
#endif

//SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));

#if GNULIB_TEST_POWF
SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));

#if GNULIB_TEST_REMAINDERF
SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
#endif
#if GNULIB_TEST_REMAINDER
SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
#endif
#if GNULIB_TEST_REMAINDERL
SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl, long double,
                 (long double, long double));
#endif

#if GNULIB_TEST_RINTF
SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
#endif
#if GNULIB_TEST_RINT
SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
#endif
#if GNULIB_TEST_RINTL
SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
#endif

#if GNULIB_TEST_ROUNDF
SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
#endif
#if GNULIB_TEST_ROUND
SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
#endif
#if GNULIB_TEST_ROUNDL
SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
#endif

#if GNULIB_TEST_SINF
SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
#if GNULIB_TEST_SINL
SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
#endif

#if GNULIB_TEST_SINHF
SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));

#if GNULIB_TEST_SQRTF
SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
#if GNULIB_TEST_SQRTL
SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
#endif

#if GNULIB_TEST_TANF
SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
#if GNULIB_TEST_TANL
SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
#endif

#if GNULIB_TEST_TANHF
SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
#endif
//SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));

#if GNULIB_TEST_TRUNCF
SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
#endif
#if GNULIB_TEST_TRUNC
SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
#endif
#if GNULIB_TEST_TRUNCL
SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
#endif

//SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));

//SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));

//SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));

#if GNULIB_TEST_ISFINITE
# ifdef isfinite
#  error "isfinite should not be a macro in C++"
# endif
REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
#endif

#if GNULIB_TEST_ISINF
# ifdef isinf
#  error "isinf should not be a macro in C++"
# endif
REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
#endif

#if GNULIB_TEST_ISNAN
# ifdef isnan
#  error "isnan should not be a macro in C++"
# endif
REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
#endif

#if GNULIB_TEST_SIGNBIT
# ifdef signbit
#  error "signbit should not be a macro in C++"
# endif
REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));
#endif


int
main ()
{
}