New module 'expm1f'.
[gnulib.git] / tests / test-math-c++.cc
1 /* Test of <math.h> substitute in C++ mode.
2    Copyright (C) 2010-2012 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
18
19 #define GNULIB_NAMESPACE gnulib
20 #include <config.h>
21
22 #include <math.h>
23
24 #include "signature.h"
25
26 /* Signature check for a function that takes a real-floating argument.
27    Check that each overloaded function with the specified signature exists.  */
28 #define REAL_FLOATING_CHECK(func,\
29                             rettype1, parameters1,\
30                             rettype2, parameters2,\
31                             rettype3, parameters3) \
32   OVERLOADED_CHECK (func, rettype1, parameters1, _1); \
33   OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
34   OVERLOADED_CHECK (func, rettype3, parameters3, _3)
35 #define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
36   static rettype (* _GL_UNUSED signature_check_ ## func ## suffix) parameters \
37     = static_cast<rettype(*)parameters>(func)
38
39
40 /* Keep these checks in the same order as math.in.h!  */
41
42 #if GNULIB_TEST_ACOSF
43 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float));
44 #endif
45 //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
46 #if GNULIB_TEST_ACOSL
47 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl, long double, (long double));
48 #endif
49
50 #if GNULIB_TEST_ASINF
51 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));
52 #endif
53 //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
54 #if GNULIB_TEST_ASINL
55 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl, long double, (long double));
56 #endif
57
58 #if GNULIB_TEST_ATANF
59 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanf, float, (float));
60 #endif
61 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
62 #if GNULIB_TEST_ATANL
63 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl, long double, (long double));
64 #endif
65
66 #if GNULIB_TEST_ATAN2F
67 SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f, float, (float, float));
68 #endif
69 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));
70
71 #if GNULIB_TEST_CBRTF
72 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtf, float, (float));
73 #endif
74 #if GNULIB_TEST_CBRT
75 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
76 #endif
77 #if GNULIB_TEST_CBRTL
78 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtl, long double, (long double));
79 #endif
80
81 #if GNULIB_TEST_CEILF
82 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
83 #endif
84 #if GNULIB_TEST_CEIL
85 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double));
86 #endif
87 #if GNULIB_TEST_CEILL
88 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
89 #endif
90
91 #if GNULIB_TEST_COPYSIGNF
92 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float));
93 #endif
94 #if GNULIB_TEST_COPYSIGN
95 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
96 #endif
97 #if GNULIB_TEST_COPYSIGNL
98 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double,
99                  (long double, long double));
100 #endif
101
102 #if GNULIB_TEST_COSF
103 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float));
104 #endif
105 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
106 #if GNULIB_TEST_COSL
107 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
108 #endif
109
110 #if GNULIB_TEST_COSHF
111 SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float));
112 #endif
113 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
114
115 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
116
117 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
118
119 #if GNULIB_TEST_EXPF
120 SIGNATURE_CHECK (GNULIB_NAMESPACE::expf, float, (float));
121 #endif
122 //SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
123 #if GNULIB_TEST_EXPL
124 SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
125 #endif
126
127 #if GNULIB_TEST_EXPM1F
128 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1f, float, (float));
129 #endif
130 #if GNULIB_TEST_EXPM1
131 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1, double, (double));
132 #endif
133
134 #if GNULIB_TEST_FABSF
135 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
136 #endif
137 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
138 #if GNULIB_TEST_FABSL
139 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsl, long double, (long double));
140 #endif
141
142 #if GNULIB_TEST_FLOORF
143 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
144 #endif
145 #if GNULIB_TEST_FLOOR
146 SIGNATURE_CHECK (GNULIB_NAMESPACE::floor, double, (double));
147 #endif
148 #if GNULIB_TEST_FLOORL
149 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
150 #endif
151
152 #if GNULIB_TEST_FMODF
153 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
154 #endif
155 #if GNULIB_TEST_FMOD
156 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
157 #endif
158 #if GNULIB_TEST_FMODL
159 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl, long double,
160                  (long double, long double));
161 #endif
162
163 #if GNULIB_TEST_FREXPF
164 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
165 #endif
166 #if GNULIB_TEST_FREXP
167 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
168 #endif
169 #if GNULIB_TEST_FREXPL
170 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
171 #endif
172
173 #if GNULIB_TEST_HYPOTF
174 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotf, float, (float, float));
175 #endif
176 #if GNULIB_TEST_HYPOT
177 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
178 #endif
179 #if GNULIB_TEST_HYPOTL
180 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotl, long double,
181                  (long double, long double));
182 #endif
183
184 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
185
186 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
187
188 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
189
190 #if GNULIB_TEST_LDEXPF
191 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
192 #endif
193 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
194 #if GNULIB_TEST_LDEXPL
195 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
196 #endif
197
198 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
199
200 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
201 #if GNULIB_TEST_LOG10L
202 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l, long double, (long double));
203 #endif
204
205 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
206
207 //SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
208
209 #if GNULIB_TEST_LOGF
210 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
211 #endif
212 //SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
213 #if GNULIB_TEST_LOGL
214 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
215 #endif
216
217 #if GNULIB_TEST_LOG10F
218 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
219 #endif
220
221 #if GNULIB_TEST_MODFF
222 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
223 #endif
224 #if GNULIB_TEST_MODF
225 SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
226 #endif
227 #if GNULIB_TEST_MODFL
228 SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl, long double,
229                  (long double, long double *));
230 #endif
231
232 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
233
234 #if GNULIB_TEST_POWF
235 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
236 #endif
237 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
238
239 #if GNULIB_TEST_REMAINDERF
240 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
241 #endif
242 #if GNULIB_TEST_REMAINDER
243 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
244 #endif
245 #if GNULIB_TEST_REMAINDERL
246 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl, long double,
247                  (long double, long double));
248 #endif
249
250 #if GNULIB_TEST_RINTF
251 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
252 #endif
253 #if GNULIB_TEST_RINT
254 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
255 #endif
256 #if GNULIB_TEST_RINTL
257 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
258 #endif
259
260 #if GNULIB_TEST_ROUNDF
261 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
262 #endif
263 #if GNULIB_TEST_ROUND
264 SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
265 #endif
266 #if GNULIB_TEST_ROUNDL
267 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
268 #endif
269
270 #if GNULIB_TEST_SINF
271 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
272 #endif
273 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
274 #if GNULIB_TEST_SINL
275 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
276 #endif
277
278 #if GNULIB_TEST_SINHF
279 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
280 #endif
281 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
282
283 #if GNULIB_TEST_SQRTF
284 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
285 #endif
286 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
287 #if GNULIB_TEST_SQRTL
288 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
289 #endif
290
291 #if GNULIB_TEST_TANF
292 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
293 #endif
294 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
295 #if GNULIB_TEST_TANL
296 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
297 #endif
298
299 #if GNULIB_TEST_TANHF
300 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
301 #endif
302 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
303
304 #if GNULIB_TEST_TRUNCF
305 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
306 #endif
307 #if GNULIB_TEST_TRUNC
308 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
309 #endif
310 #if GNULIB_TEST_TRUNCL
311 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
312 #endif
313
314 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
315
316 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
317
318 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
319
320 #if GNULIB_TEST_ISFINITE
321 # ifdef isfinite
322 #  error "isfinite should not be a macro in C++"
323 # endif
324 REAL_FLOATING_CHECK (isfinite, int, (float), int, (double), int, (long double));
325 #endif
326
327 #if GNULIB_TEST_ISINF
328 # ifdef isinf
329 #  error "isinf should not be a macro in C++"
330 # endif
331 REAL_FLOATING_CHECK (isinf, int, (float), int, (double), int, (long double));
332 #endif
333
334 #if GNULIB_TEST_ISNAN
335 # ifdef isnan
336 #  error "isnan should not be a macro in C++"
337 # endif
338 REAL_FLOATING_CHECK (isnan, int, (float), int, (double), int, (long double));
339 #endif
340
341 #if GNULIB_TEST_SIGNBIT
342 # ifdef signbit
343 #  error "signbit should not be a macro in C++"
344 # endif
345 REAL_FLOATING_CHECK (signbit, int, (float), int, (double), int, (long double));
346 #endif
347
348
349 int
350 main ()
351 {
352 }