1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// This test fails because Clang no longer enables -fdelayed-template-parsing
10// by default on Windows with C++20 (#69431).
11// XFAIL: msvc && (clang-18 || clang-19)
12
13// <math.h>
14
15#include <math.h>
16#include <type_traits>
17#include <cassert>
18
19#include "test_macros.h"
20#include "hexfloat.h"
21#include "truncate_fp.h"
22#include "type_algorithms.h"
23
24// convertible to int/float/double/etc
25template <class T, int N=0>
26struct Value {
27 operator T () { return T(N); }
28};
29
30// See PR21083
31// Ambiguous is a user-defined type that defines its own overloads of cmath
32// functions. When the std overloads are candidates too (by using or adl),
33// they should not interfere.
34struct Ambiguous : std::true_type { // ADL
35 operator float () { return 0.f; }
36 operator double () { return 0.; }
37};
38Ambiguous abs(Ambiguous){ return Ambiguous(); }
39Ambiguous acos(Ambiguous){ return Ambiguous(); }
40Ambiguous asin(Ambiguous){ return Ambiguous(); }
41Ambiguous atan(Ambiguous){ return Ambiguous(); }
42Ambiguous atan2(Ambiguous, Ambiguous){ return Ambiguous(); }
43Ambiguous ceil(Ambiguous){ return Ambiguous(); }
44Ambiguous cos(Ambiguous){ return Ambiguous(); }
45Ambiguous cosh(Ambiguous){ return Ambiguous(); }
46Ambiguous exp(Ambiguous){ return Ambiguous(); }
47Ambiguous fabs(Ambiguous){ return Ambiguous(); }
48Ambiguous floor(Ambiguous){ return Ambiguous(); }
49Ambiguous fmod(Ambiguous, Ambiguous){ return Ambiguous(); }
50Ambiguous frexp(Ambiguous, int*){ return Ambiguous(); }
51Ambiguous ldexp(Ambiguous, int){ return Ambiguous(); }
52Ambiguous log(Ambiguous){ return Ambiguous(); }
53Ambiguous log10(Ambiguous){ return Ambiguous(); }
54Ambiguous modf(Ambiguous, Ambiguous*){ return Ambiguous(); }
55Ambiguous pow(Ambiguous, Ambiguous){ return Ambiguous(); }
56Ambiguous sin(Ambiguous){ return Ambiguous(); }
57Ambiguous sinh(Ambiguous){ return Ambiguous(); }
58Ambiguous sqrt(Ambiguous){ return Ambiguous(); }
59Ambiguous tan(Ambiguous){ return Ambiguous(); }
60Ambiguous tanh(Ambiguous){ return Ambiguous(); }
61Ambiguous signbit(Ambiguous){ return Ambiguous(); }
62Ambiguous fpclassify(Ambiguous){ return Ambiguous(); }
63Ambiguous isfinite(Ambiguous){ return Ambiguous(); }
64Ambiguous isnormal(Ambiguous){ return Ambiguous(); }
65Ambiguous isgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
66Ambiguous isgreaterequal(Ambiguous, Ambiguous){ return Ambiguous(); }
67Ambiguous isless(Ambiguous, Ambiguous){ return Ambiguous(); }
68Ambiguous islessequal(Ambiguous, Ambiguous){ return Ambiguous(); }
69Ambiguous islessgreater(Ambiguous, Ambiguous){ return Ambiguous(); }
70Ambiguous isunordered(Ambiguous, Ambiguous){ return Ambiguous(); }
71Ambiguous acosh(Ambiguous){ return Ambiguous(); }
72Ambiguous asinh(Ambiguous){ return Ambiguous(); }
73Ambiguous atanh(Ambiguous){ return Ambiguous(); }
74Ambiguous cbrt(Ambiguous){ return Ambiguous(); }
75Ambiguous copysign(Ambiguous, Ambiguous){ return Ambiguous(); }
76Ambiguous erf(Ambiguous){ return Ambiguous(); }
77Ambiguous erfc(Ambiguous){ return Ambiguous(); }
78Ambiguous exp2(Ambiguous){ return Ambiguous(); }
79Ambiguous expm1(Ambiguous){ return Ambiguous(); }
80Ambiguous fdim(Ambiguous, Ambiguous){ return Ambiguous(); }
81Ambiguous fma(Ambiguous, Ambiguous, Ambiguous){ return Ambiguous(); }
82Ambiguous fmax(Ambiguous, Ambiguous){ return Ambiguous(); }
83Ambiguous fmin(Ambiguous, Ambiguous){ return Ambiguous(); }
84Ambiguous hypot(Ambiguous, Ambiguous){ return Ambiguous(); }
85Ambiguous ilogb(Ambiguous){ return Ambiguous(); }
86Ambiguous lgamma(Ambiguous){ return Ambiguous(); }
87Ambiguous llrint(Ambiguous){ return Ambiguous(); }
88Ambiguous llround(Ambiguous){ return Ambiguous(); }
89Ambiguous log1p(Ambiguous){ return Ambiguous(); }
90Ambiguous log2(Ambiguous){ return Ambiguous(); }
91Ambiguous logb(Ambiguous){ return Ambiguous(); }
92Ambiguous lrint(Ambiguous){ return Ambiguous(); }
93Ambiguous lround(Ambiguous){ return Ambiguous(); }
94Ambiguous nearbyint(Ambiguous){ return Ambiguous(); }
95Ambiguous nextafter(Ambiguous, Ambiguous){ return Ambiguous(); }
96Ambiguous nexttoward(Ambiguous, Ambiguous){ return Ambiguous(); }
97Ambiguous remainder(Ambiguous, Ambiguous){ return Ambiguous(); }
98Ambiguous remquo(Ambiguous, Ambiguous, int*){ return Ambiguous(); }
99Ambiguous rint(Ambiguous){ return Ambiguous(); }
100Ambiguous round(Ambiguous){ return Ambiguous(); }
101Ambiguous scalbln(Ambiguous, Ambiguous){ return Ambiguous(); }
102Ambiguous scalbn(Ambiguous, Ambiguous){ return Ambiguous(); }
103Ambiguous tgamma(Ambiguous){ return Ambiguous(); }
104Ambiguous trunc(Ambiguous){ return Ambiguous(); }
105
106template <class T, class = decltype(::abs(std::declval<T>()))>
107std::true_type has_abs_imp(int);
108template <class T>
109std::false_type has_abs_imp(...);
110
111template <class T>
112struct has_abs : decltype(has_abs_imp<T>(0)) {};
113
114void test_abs() {
115 TEST_DIAGNOSTIC_PUSH
116 TEST_CLANG_DIAGNOSTIC_IGNORED("-Wabsolute-value")
117
118 ASSERT_SAME_TYPE(decltype(abs((float)0)), float);
119 ASSERT_SAME_TYPE(decltype(abs((double)0)), double);
120 ASSERT_SAME_TYPE(decltype(abs((long double)0)), long double);
121 ASSERT_SAME_TYPE(decltype(abs((int)0)), int);
122 ASSERT_SAME_TYPE(decltype(abs((long)0)), long);
123 ASSERT_SAME_TYPE(decltype(abs((long long)0)), long long);
124 ASSERT_SAME_TYPE(decltype(abs((unsigned char)0)), int);
125 ASSERT_SAME_TYPE(decltype(abs((unsigned short)0)), int);
126 ASSERT_SAME_TYPE(decltype(abs(Ambiguous())), Ambiguous);
127
128 static_assert(!has_abs<unsigned>::value, "");
129 static_assert(!has_abs<unsigned long>::value, "");
130 static_assert(!has_abs<unsigned long long>::value, "");
131
132 TEST_DIAGNOSTIC_POP
133
134 assert(abs(-1.) == 1);
135}
136
137void test_acos() {
138 ASSERT_SAME_TYPE(decltype(acosf(0)), float);
139 ASSERT_SAME_TYPE(decltype(acosl(0)), long double);
140 ASSERT_SAME_TYPE(decltype(acos(Ambiguous())), Ambiguous);
141 assert(acos(1) == 0);
142}
143
144void test_asin() {
145 ASSERT_SAME_TYPE(decltype(asinf(0)), float);
146 ASSERT_SAME_TYPE(decltype(asinl(0)), long double);
147 ASSERT_SAME_TYPE(decltype(asin(Ambiguous())), Ambiguous);
148 assert(asin(0) == 0);
149}
150
151void test_atan() {
152 ASSERT_SAME_TYPE(decltype(atanf(0)), float);
153 ASSERT_SAME_TYPE(decltype(atanl(0)), long double);
154 ASSERT_SAME_TYPE(decltype(atan(Ambiguous())), Ambiguous);
155 assert(atan(0) == 0);
156}
157
158void test_atan2() {
159 ASSERT_SAME_TYPE(decltype(atan2f(0,0)), float);
160 ASSERT_SAME_TYPE(decltype(atan2l(0,0)), long double);
161 ASSERT_SAME_TYPE(decltype(atan2(Ambiguous(), Ambiguous())), Ambiguous);
162 assert(atan2(0,1) == 0);
163}
164
165void test_ceil() {
166 ASSERT_SAME_TYPE(decltype(ceilf(0)), float);
167 ASSERT_SAME_TYPE(decltype(ceill(0)), long double);
168 ASSERT_SAME_TYPE(decltype(ceil(Ambiguous())), Ambiguous);
169 assert(ceil(0) == 0);
170}
171
172void test_cos() {
173 ASSERT_SAME_TYPE(decltype(cosf(0)), float);
174 ASSERT_SAME_TYPE(decltype(cosl(0)), long double);
175 ASSERT_SAME_TYPE(decltype(cos(Ambiguous())), Ambiguous);
176 assert(cos(0) == 1);
177}
178
179void test_cosh() {
180 ASSERT_SAME_TYPE(decltype(coshf(0)), float);
181 ASSERT_SAME_TYPE(decltype(coshl(0)), long double);
182 ASSERT_SAME_TYPE(decltype(cosh(Ambiguous())), Ambiguous);
183 assert(cosh(0) == 1);
184}
185
186void test_exp() {
187 ASSERT_SAME_TYPE(decltype(expf(0)), float);
188 ASSERT_SAME_TYPE(decltype(expl(0)), long double);
189 ASSERT_SAME_TYPE(decltype(exp(Ambiguous())), Ambiguous);
190 assert(exp(0) == 1);
191}
192
193void test_fabs() {
194 ASSERT_SAME_TYPE(decltype(fabsf(0.0f)), float);
195 ASSERT_SAME_TYPE(decltype(fabsl(0.0L)), long double);
196 ASSERT_SAME_TYPE(decltype(fabs(Ambiguous())), Ambiguous);
197 assert(fabs(-1) == 1);
198}
199
200void test_floor() {
201 ASSERT_SAME_TYPE(decltype(floorf(0)), float);
202 ASSERT_SAME_TYPE(decltype(floorl(0)), long double);
203 ASSERT_SAME_TYPE(decltype(floor(Ambiguous())), Ambiguous);
204 assert(floor(1) == 1);
205}
206
207void test_fmod() {
208 ASSERT_SAME_TYPE(decltype(fmodf(0,0)), float);
209 ASSERT_SAME_TYPE(decltype(fmodl(0,0)), long double);
210 ASSERT_SAME_TYPE(decltype(fmod(Ambiguous(), Ambiguous())), Ambiguous);
211 assert(fmod(1.5,1) == .5);
212}
213
214void test_frexp() {
215 int ip;
216 ASSERT_SAME_TYPE(decltype(frexpf(0, &ip)), float);
217 ASSERT_SAME_TYPE(decltype(frexpl(0, &ip)), long double);
218 ASSERT_SAME_TYPE(decltype(frexp(Ambiguous(), &ip)), Ambiguous);
219 assert(frexp(0, &ip) == 0);
220}
221
222void test_ldexp() {
223 int ip = 1;
224 ASSERT_SAME_TYPE(decltype(ldexpf(0, ip)), float);
225 ASSERT_SAME_TYPE(decltype(ldexpl(0, ip)), long double);
226 ASSERT_SAME_TYPE(decltype(ldexp(Ambiguous(), ip)), Ambiguous);
227 assert(ldexp(1, ip) == 2);
228}
229
230void test_log() {
231 ASSERT_SAME_TYPE(decltype(logf(0)), float);
232 ASSERT_SAME_TYPE(decltype(logl(0)), long double);
233 ASSERT_SAME_TYPE(decltype(log(Ambiguous())), Ambiguous);
234 assert(log(1) == 0);
235}
236
237void test_log10() {
238 ASSERT_SAME_TYPE(decltype(log10f(0)), float);
239 ASSERT_SAME_TYPE(decltype(log10l(0)), long double);
240 ASSERT_SAME_TYPE(decltype(log10(Ambiguous())), Ambiguous);
241 assert(log10(1) == 0);
242}
243
244void test_modf() {
245 ASSERT_SAME_TYPE(decltype(modf((float)0, (float*)0)), float);
246 ASSERT_SAME_TYPE(decltype(modf((double)0, (double*)0)), double);
247 ASSERT_SAME_TYPE(decltype(modf((long double)0, (long double*)0)), long double);
248 ASSERT_SAME_TYPE(decltype(modff(0, (float*)0)), float);
249 ASSERT_SAME_TYPE(decltype(modfl(0, (long double*)0)), long double);
250 ASSERT_SAME_TYPE(decltype(modf(Ambiguous(), (Ambiguous*)0)), Ambiguous);
251 double i;
252 assert(modf(1., &i) == 0);
253}
254
255void test_pow() {
256 ASSERT_SAME_TYPE(decltype(powf(0,0)), float);
257 ASSERT_SAME_TYPE(decltype(powl(0,0)), long double);
258 ASSERT_SAME_TYPE(decltype(pow((int)0, (int)0)), double);
259 // ASSERT_SAME_TYPE(decltype(pow(Value<int>(), (int)0)), double);
260 // ASSERT_SAME_TYPE(decltype(pow(Value<long double>(), (float)0)), long double);
261 // ASSERT_SAME_TYPE(decltype(pow((float) 0, Value<float>())), float);
262 ASSERT_SAME_TYPE(decltype(pow(Ambiguous(), Ambiguous())), Ambiguous);
263 assert(pow(1,1) == 1);
264 // assert(pow(Value<int,1>(), Value<float,1>()) == 1);
265 // assert(pow(1.0f, Value<double,1>()) == 1);
266 // assert(pow(1.0, Value<int,1>()) == 1);
267 // assert(pow(Value<long double,1>(), 1LL) == 1);
268}
269
270void test_sin() {
271 ASSERT_SAME_TYPE(decltype(sinf(0)), float);
272 ASSERT_SAME_TYPE(decltype(sinl(0)), long double);
273 ASSERT_SAME_TYPE(decltype(sin(Ambiguous())), Ambiguous);
274 assert(sin(0) == 0);
275}
276
277void test_sinh() {
278 ASSERT_SAME_TYPE(decltype(sinhf(0)), float);
279 ASSERT_SAME_TYPE(decltype(sinhl(0)), long double);
280 ASSERT_SAME_TYPE(decltype(sinh(Ambiguous())), Ambiguous);
281 assert(sinh(0) == 0);
282}
283
284void test_sqrt() {
285 ASSERT_SAME_TYPE(decltype(sqrtf(0)), float);
286 ASSERT_SAME_TYPE(decltype(sqrtl(0)), long double);
287 ASSERT_SAME_TYPE(decltype(sqrt(Ambiguous())), Ambiguous);
288 assert(sqrt(4) == 2);
289}
290
291void test_tan() {
292 ASSERT_SAME_TYPE(decltype(tanf(0)), float);
293 ASSERT_SAME_TYPE(decltype(tanl(0)), long double);
294 ASSERT_SAME_TYPE(decltype(tan(Ambiguous())), Ambiguous);
295 assert(tan(0) == 0);
296}
297
298void test_tanh() {
299 ASSERT_SAME_TYPE(decltype(tanhf(0)), float);
300 ASSERT_SAME_TYPE(decltype(tanhl(0)), long double);
301 ASSERT_SAME_TYPE(decltype(tanh(Ambiguous())), Ambiguous);
302 assert(tanh(0) == 0);
303}
304
305void test_signbit() {
306#ifdef signbit
307#error signbit defined
308#endif
309 ASSERT_SAME_TYPE(decltype(signbit(Ambiguous())), Ambiguous);
310 assert(signbit(-1.0) == true);
311}
312
313void test_fpclassify() {
314#ifdef fpclassify
315#error fpclassify defined
316#endif
317 ASSERT_SAME_TYPE(decltype(fpclassify(Ambiguous())), Ambiguous);
318 assert(fpclassify(-1.0) == FP_NORMAL);
319}
320
321void test_isfinite() {
322#ifdef isfinite
323#error isfinite defined
324#endif
325 ASSERT_SAME_TYPE(decltype(isfinite(Ambiguous())), Ambiguous);
326 assert(isfinite(-1.0) == true);
327}
328
329void test_isnormal() {
330#ifdef isnormal
331#error isnormal defined
332#endif
333 ASSERT_SAME_TYPE(decltype(isnormal(Ambiguous())), Ambiguous);
334 assert(isnormal(-1.0) == true);
335}
336
337void test_isgreater() {
338#ifdef isgreater
339#error isgreater defined
340#endif
341 ASSERT_SAME_TYPE(decltype(isgreater(Ambiguous(), Ambiguous())), Ambiguous);
342 assert(isgreater(-1.0, 0.F) == false);
343}
344
345void test_isgreaterequal() {
346#ifdef isgreaterequal
347#error isgreaterequal defined
348#endif
349 ASSERT_SAME_TYPE(decltype(isgreaterequal(Ambiguous(), Ambiguous())), Ambiguous);
350 assert(isgreaterequal(-1.0, 0.F) == false);
351}
352
353void test_isinf() {
354#ifdef isinf
355#error isinf defined
356#endif
357 ASSERT_SAME_TYPE(decltype(isinf((float)0)), bool);
358
359 typedef decltype(isinf(x: (double)0)) DoubleRetType;
360#ifndef __linux__
361 ASSERT_SAME_TYPE(DoubleRetType, bool);
362#else
363 // GLIBC < 2.26 defines 'isinf(double)' with a return type of 'int' in
364 // all C++ dialects. The test should tolerate this.
365 // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
366 static_assert((std::is_same<DoubleRetType, bool>::value
367 || std::is_same<DoubleRetType, int>::value), "");
368#endif
369
370 ASSERT_SAME_TYPE(decltype(isinf(0)), bool);
371 ASSERT_SAME_TYPE(decltype(isinf((long double)0)), bool);
372 assert(isinf(-1.0) == false);
373}
374
375void test_isless() {
376#ifdef isless
377#error isless defined
378#endif
379 ASSERT_SAME_TYPE(decltype(isless(Ambiguous(), Ambiguous())), Ambiguous);
380 assert(isless(-1.0, 0.F) == true);
381}
382
383void test_islessequal() {
384#ifdef islessequal
385#error islessequal defined
386#endif
387 ASSERT_SAME_TYPE(decltype(islessequal(Ambiguous(), Ambiguous())), Ambiguous);
388 assert(islessequal(-1.0, 0.F) == true);
389}
390
391void test_islessgreater() {
392#ifdef islessgreater
393#error islessgreater defined
394#endif
395 ASSERT_SAME_TYPE(decltype(islessgreater(Ambiguous(), Ambiguous())), Ambiguous);
396 assert(islessgreater(-1.0, 0.F) == true);
397}
398
399void test_isnan() {
400#ifdef isnan
401#error isnan defined
402#endif
403 ASSERT_SAME_TYPE(decltype(isnan((float)0)), bool);
404
405 typedef decltype(isnan(x: (double)0)) DoubleRetType;
406#ifndef __linux__
407 ASSERT_SAME_TYPE(DoubleRetType, bool);
408#else
409 // GLIBC < 2.26 defines 'isnan(double)' with a return type of 'int' in
410 // all C++ dialects. The test should tolerate this.
411 // See: https://sourceware.org/bugzilla/show_bug.cgi?id=19439
412 static_assert((std::is_same<DoubleRetType, bool>::value
413 || std::is_same<DoubleRetType, int>::value), "");
414#endif
415
416 ASSERT_SAME_TYPE(decltype(isnan(0)), bool);
417 ASSERT_SAME_TYPE(decltype(isnan((long double)0)), bool);
418 assert(isnan(-1.0) == false);
419}
420
421void test_isunordered() {
422#ifdef isunordered
423#error isunordered defined
424#endif
425 ASSERT_SAME_TYPE(decltype(isunordered(Ambiguous(), Ambiguous())), Ambiguous);
426 assert(isunordered(-1.0, 0.F) == false);
427}
428
429void test_acosh() {
430 ASSERT_SAME_TYPE(decltype(acoshf(0)), float);
431 ASSERT_SAME_TYPE(decltype(acoshl(0)), long double);
432 ASSERT_SAME_TYPE(decltype(acosh(Ambiguous())), Ambiguous);
433 assert(acosh(1) == 0);
434}
435
436void test_asinh() {
437 ASSERT_SAME_TYPE(decltype(asinhf(0)), float);
438 ASSERT_SAME_TYPE(decltype(asinhl(0)), long double);
439 ASSERT_SAME_TYPE(decltype(asinh(Ambiguous())), Ambiguous);
440 assert(asinh(0) == 0);
441}
442
443void test_atanh() {
444 ASSERT_SAME_TYPE(decltype(atanhf(0)), float);
445 ASSERT_SAME_TYPE(decltype(atanhl(0)), long double);
446 ASSERT_SAME_TYPE(decltype(atanh(Ambiguous())), Ambiguous);
447 assert(atanh(0) == 0);
448}
449
450void test_cbrt() {
451 ASSERT_SAME_TYPE(decltype(cbrtf(0)), float);
452 ASSERT_SAME_TYPE(decltype(cbrtl(0)), long double);
453 ASSERT_SAME_TYPE(decltype(cbrt(Ambiguous())), Ambiguous);
454 assert(truncate_fp(cbrt(1)) == 1);
455}
456
457void test_copysign() {
458 ASSERT_SAME_TYPE(decltype(copysignf(0,0)), float);
459 ASSERT_SAME_TYPE(decltype(copysignl(0,0)), long double);
460 ASSERT_SAME_TYPE(decltype(copysign((int)0, (int)0)), double);
461 ASSERT_SAME_TYPE(decltype(copysign(Ambiguous(), Ambiguous())), Ambiguous);
462 assert(copysign(1,1) == 1);
463}
464
465void test_erf() {
466 ASSERT_SAME_TYPE(decltype(erff(0)), float);
467 ASSERT_SAME_TYPE(decltype(erfl(0)), long double);
468 ASSERT_SAME_TYPE(decltype(erf(Ambiguous())), Ambiguous);
469 assert(erf(0) == 0);
470}
471
472void test_erfc() {
473 ASSERT_SAME_TYPE(decltype(erfcf(0)), float);
474 ASSERT_SAME_TYPE(decltype(erfcl(0)), long double);
475 ASSERT_SAME_TYPE(decltype(erfc(Ambiguous())), Ambiguous);
476 assert(erfc(0) == 1);
477}
478
479void test_exp2() {
480 ASSERT_SAME_TYPE(decltype(exp2f(0)), float);
481 ASSERT_SAME_TYPE(decltype(exp2l(0)), long double);
482 ASSERT_SAME_TYPE(decltype(exp2(Ambiguous())), Ambiguous);
483 assert(exp2(1) == 2);
484}
485
486void test_expm1() {
487 ASSERT_SAME_TYPE(decltype(expm1f(0)), float);
488 ASSERT_SAME_TYPE(decltype(expm1l(0)), long double);
489 ASSERT_SAME_TYPE(decltype(expm1(Ambiguous())), Ambiguous);
490 assert(expm1(0) == 0);
491}
492
493void test_fdim() {
494 ASSERT_SAME_TYPE(decltype(fdimf(0,0)), float);
495 ASSERT_SAME_TYPE(decltype(fdiml(0,0)), long double);
496 ASSERT_SAME_TYPE(decltype(fdim((int)0, (int)0)), double);
497 ASSERT_SAME_TYPE(decltype(fdim(Ambiguous(), Ambiguous())), Ambiguous);
498 assert(fdim(1,0) == 1);
499}
500
501void test_fma() {
502 ASSERT_SAME_TYPE(decltype(fma((bool)0, (float)0, (float)0)), double);
503 ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (double)0)), double);
504 ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (long double)0)), long double);
505 ASSERT_SAME_TYPE(decltype(fma((float)0, (float)0, (float)0)), float);
506
507 ASSERT_SAME_TYPE(decltype(fma((bool)0, (double)0, (double)0)), double);
508 ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (float)0)), double);
509 ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (long double)0)), long double);
510 ASSERT_SAME_TYPE(decltype(fma((double)0, (double)0, (double)0)), double);
511
512 ASSERT_SAME_TYPE(decltype(fma((long double)0, (long double)0, (float)0)), long double);
513 ASSERT_SAME_TYPE(decltype(fma((double)0, (long double)0, (long double)0)), long double);
514 ASSERT_SAME_TYPE(decltype(fma((long double)0, (long double)0, (long double)0)), long double);
515
516 ASSERT_SAME_TYPE(decltype(fmaf(0,0,0)), float);
517 ASSERT_SAME_TYPE(decltype(fmal(0,0,0)), long double);
518 ASSERT_SAME_TYPE(decltype(fma(Ambiguous(), Ambiguous(), Ambiguous())), Ambiguous);
519 assert(fma(1,1,1) == 2);
520}
521
522void test_fmax() {
523 ASSERT_SAME_TYPE(decltype(fmaxf(0,0)), float);
524 ASSERT_SAME_TYPE(decltype(fmaxl(0,0)), long double);
525 ASSERT_SAME_TYPE(decltype(fmax((int)0, (int)0)), double);
526 ASSERT_SAME_TYPE(decltype(fmax(Ambiguous(), Ambiguous())), Ambiguous);
527 assert(fmax(1,0) == 1);
528}
529
530void test_fmin() {
531 ASSERT_SAME_TYPE(decltype(fminf(0,0)), float);
532 ASSERT_SAME_TYPE(decltype(fminl(0,0)), long double);
533 ASSERT_SAME_TYPE(decltype(fmin((int)0, (int)0)), double);
534 ASSERT_SAME_TYPE(decltype(fmin(Ambiguous(), Ambiguous())), Ambiguous);
535 assert(fmin(1,0) == 0);
536}
537
538void test_hypot() {
539 ASSERT_SAME_TYPE(decltype(hypotf(0,0)), float);
540 ASSERT_SAME_TYPE(decltype(hypotl(0,0)), long double);
541 ASSERT_SAME_TYPE(decltype(hypot((int)0, (int)0)), double);
542 ASSERT_SAME_TYPE(decltype(hypot(Ambiguous(), Ambiguous())), Ambiguous);
543 assert(hypot(3,4) == 5);
544}
545
546void test_ilogb() {
547 ASSERT_SAME_TYPE(decltype(ilogbf(0)), int);
548 ASSERT_SAME_TYPE(decltype(ilogbl(0)), int);
549 ASSERT_SAME_TYPE(decltype(ilogb(Ambiguous())), Ambiguous);
550 assert(ilogb(1) == 0);
551}
552
553void test_lgamma() {
554 ASSERT_SAME_TYPE(decltype(lgammaf(0)), float);
555 ASSERT_SAME_TYPE(decltype(lgammal(0)), long double);
556 ASSERT_SAME_TYPE(decltype(lgamma(Ambiguous())), Ambiguous);
557 assert(lgamma(1) == 0);
558}
559
560void test_llrint() {
561 ASSERT_SAME_TYPE(decltype(llrintf(0)), long long);
562 ASSERT_SAME_TYPE(decltype(llrintl(0)), long long);
563 ASSERT_SAME_TYPE(decltype(llrint(Ambiguous())), Ambiguous);
564 assert(llrint(1) == 1LL);
565}
566
567void test_llround() {
568 ASSERT_SAME_TYPE(decltype(llroundf(0)), long long);
569 ASSERT_SAME_TYPE(decltype(llroundl(0)), long long);
570 ASSERT_SAME_TYPE(decltype(llround(Ambiguous())), Ambiguous);
571 assert(llround(1) == 1LL);
572}
573
574void test_log1p() {
575 ASSERT_SAME_TYPE(decltype(log1pf(0)), float);
576 ASSERT_SAME_TYPE(decltype(log1pl(0)), long double);
577 ASSERT_SAME_TYPE(decltype(log1p(Ambiguous())), Ambiguous);
578 assert(log1p(0) == 0);
579}
580
581void test_log2() {
582 ASSERT_SAME_TYPE(decltype(log2f(0)), float);
583 ASSERT_SAME_TYPE(decltype(log2l(0)), long double);
584 ASSERT_SAME_TYPE(decltype(log2(Ambiguous())), Ambiguous);
585 assert(log2(1) == 0);
586}
587
588void test_logb() {
589 ASSERT_SAME_TYPE(decltype(logbf(0)), float);
590 ASSERT_SAME_TYPE(decltype(logbl(0)), long double);
591 ASSERT_SAME_TYPE(decltype(logb(Ambiguous())), Ambiguous);
592 assert(logb(1) == 0);
593}
594
595void test_lrint() {
596 ASSERT_SAME_TYPE(decltype(lrintf(0)), long);
597 ASSERT_SAME_TYPE(decltype(lrintl(0)), long);
598 ASSERT_SAME_TYPE(decltype(lrint(Ambiguous())), Ambiguous);
599 assert(lrint(1) == 1L);
600}
601
602void test_lround() {
603 ASSERT_SAME_TYPE(decltype(lroundf(0)), long);
604 ASSERT_SAME_TYPE(decltype(lroundl(0)), long);
605 ASSERT_SAME_TYPE(decltype(lround(Ambiguous())), Ambiguous);
606 assert(lround(1) == 1L);
607}
608
609void test_nan() {
610 ASSERT_SAME_TYPE(decltype(nan("")), double);
611 ASSERT_SAME_TYPE(decltype(nanf("")), float);
612 ASSERT_SAME_TYPE(decltype(nanl("")), long double);
613}
614
615void test_nearbyint() {
616 ASSERT_SAME_TYPE(decltype(nearbyintf(0)), float);
617 ASSERT_SAME_TYPE(decltype(nearbyintl(0)), long double);
618 ASSERT_SAME_TYPE(decltype(nearbyint(Ambiguous())), Ambiguous);
619 assert(nearbyint(1) == 1);
620}
621
622void test_nextafter() {
623 ASSERT_SAME_TYPE(decltype(nextafterf(0,0)), float);
624 ASSERT_SAME_TYPE(decltype(nextafterl(0,0)), long double);
625 ASSERT_SAME_TYPE(decltype(nextafter((int)0, (int)0)), double);
626 ASSERT_SAME_TYPE(decltype(nextafter(Ambiguous(), Ambiguous())), Ambiguous);
627 assert(nextafter(0,1) == hexfloat<double>(0x1, 0, -1074));
628}
629
630void test_nexttoward() {
631 ASSERT_SAME_TYPE(decltype(nexttoward((float)0, (long double)0)), float);
632 ASSERT_SAME_TYPE(decltype(nexttoward((bool)0, (long double)0)), double);
633 ASSERT_SAME_TYPE(decltype(nexttoward((unsigned short)0, (long double)0)), double);
634 ASSERT_SAME_TYPE(decltype(nexttoward((int)0, (long double)0)), double);
635 ASSERT_SAME_TYPE(decltype(nexttoward((unsigned int)0, (long double)0)), double);
636 ASSERT_SAME_TYPE(decltype(nexttoward((long)0, (long double)0)), double);
637 ASSERT_SAME_TYPE(decltype(nexttoward((unsigned long)0, (long double)0)), double);
638 ASSERT_SAME_TYPE(decltype(nexttoward((long long)0, (long double)0)), double);
639 ASSERT_SAME_TYPE(decltype(nexttoward((unsigned long long)0, (long double)0)), double);
640 ASSERT_SAME_TYPE(decltype(nexttoward((double)0, (long double)0)), double);
641 ASSERT_SAME_TYPE(decltype(nexttoward((long double)0, (long double)0)), long double);
642 ASSERT_SAME_TYPE(decltype(nexttowardf(0, (long double)0)), float);
643 ASSERT_SAME_TYPE(decltype(nexttowardl(0, (long double)0)), long double);
644 ASSERT_SAME_TYPE(decltype(nexttoward(Ambiguous(), Ambiguous())), Ambiguous);
645 assert(nexttoward(0, 1) == hexfloat<double>(0x1, 0, -1074));
646}
647
648void test_remainder() {
649 ASSERT_SAME_TYPE(decltype(remainderf(0,0)), float);
650 ASSERT_SAME_TYPE(decltype(remainderl(0,0)), long double);
651 ASSERT_SAME_TYPE(decltype(remainder((int)0, (int)0)), double);
652 ASSERT_SAME_TYPE(decltype(remainder(Ambiguous(), Ambiguous())), Ambiguous);
653 assert(remainder(0.5,1) == 0.5);
654}
655
656void test_remquo() {
657 int ip;
658 ASSERT_SAME_TYPE(decltype(remquof(0,0, &ip)), float);
659 ASSERT_SAME_TYPE(decltype(remquol(0,0, &ip)), long double);
660 ASSERT_SAME_TYPE(decltype(remquo((int)0, (int)0, &ip)), double);
661 ASSERT_SAME_TYPE(decltype(remquo(Ambiguous(), Ambiguous(), &ip)), Ambiguous);
662 assert(remquo(0.5,1, &ip) == 0.5);
663}
664
665void test_rint() {
666 ASSERT_SAME_TYPE(decltype(rintf(0)), float);
667 ASSERT_SAME_TYPE(decltype(rintl(0)), long double);
668 ASSERT_SAME_TYPE(decltype(rint(Ambiguous())), Ambiguous);
669 assert(rint(1) == 1);
670}
671
672void test_round() {
673 ASSERT_SAME_TYPE(decltype(roundf(0)), float);
674 ASSERT_SAME_TYPE(decltype(roundl(0)), long double);
675 ASSERT_SAME_TYPE(decltype(round(Ambiguous())), Ambiguous);
676 assert(round(1) == 1);
677}
678
679void test_scalbln() {
680 ASSERT_SAME_TYPE(decltype(scalbln((float)0, (long)0)), float);
681 ASSERT_SAME_TYPE(decltype(scalbln((bool)0, (long)0)), double);
682 ASSERT_SAME_TYPE(decltype(scalbln((unsigned short)0, (long)0)), double);
683 ASSERT_SAME_TYPE(decltype(scalbln((int)0, (long)0)), double);
684 ASSERT_SAME_TYPE(decltype(scalbln((unsigned int)0, (long)0)), double);
685 ASSERT_SAME_TYPE(decltype(scalbln((long)0, (long)0)), double);
686 ASSERT_SAME_TYPE(decltype(scalbln((unsigned long)0, (long)0)), double);
687 ASSERT_SAME_TYPE(decltype(scalbln((long long)0, (long)0)), double);
688 ASSERT_SAME_TYPE(decltype(scalbln((unsigned long long)0, (long)0)), double);
689 ASSERT_SAME_TYPE(decltype(scalbln((double)0, (long)0)), double);
690 ASSERT_SAME_TYPE(decltype(scalbln((long double)0, (long)0)), long double);
691 ASSERT_SAME_TYPE(decltype(scalblnf(0, (long)0)), float);
692 ASSERT_SAME_TYPE(decltype(scalblnl(0, (long)0)), long double);
693 ASSERT_SAME_TYPE(decltype(scalbln(Ambiguous(), Ambiguous())), Ambiguous);
694 assert(scalbln(1, 1) == 2);
695}
696
697void test_scalbn() {
698 ASSERT_SAME_TYPE(decltype(scalbn((float)0, (int)0)), float);
699 ASSERT_SAME_TYPE(decltype(scalbn((bool)0, (int)0)), double);
700 ASSERT_SAME_TYPE(decltype(scalbn((unsigned short)0, (int)0)), double);
701 ASSERT_SAME_TYPE(decltype(scalbn((int)0, (int)0)), double);
702 ASSERT_SAME_TYPE(decltype(scalbn((unsigned int)0, (int)0)), double);
703 ASSERT_SAME_TYPE(decltype(scalbn((long)0, (int)0)), double);
704 ASSERT_SAME_TYPE(decltype(scalbn((unsigned long)0, (int)0)), double);
705 ASSERT_SAME_TYPE(decltype(scalbn((long long)0, (int)0)), double);
706 ASSERT_SAME_TYPE(decltype(scalbn((unsigned long long)0, (int)0)), double);
707 ASSERT_SAME_TYPE(decltype(scalbn((double)0, (int)0)), double);
708 ASSERT_SAME_TYPE(decltype(scalbn((long double)0, (int)0)), long double);
709 ASSERT_SAME_TYPE(decltype(scalbnf(0, (int)0)), float);
710 ASSERT_SAME_TYPE(decltype(scalbnl(0, (int)0)), long double);
711 ASSERT_SAME_TYPE(decltype(scalbn(Ambiguous(), Ambiguous())), Ambiguous);
712 assert(scalbn(1, 1) == 2);
713}
714
715void test_tgamma() {
716 ASSERT_SAME_TYPE(decltype(tgammaf(0)), float);
717 ASSERT_SAME_TYPE(decltype(tgammal(0)), long double);
718 ASSERT_SAME_TYPE(decltype(tgamma(Ambiguous())), Ambiguous);
719 assert(tgamma(1) == 1);
720}
721
722void test_trunc() {
723 ASSERT_SAME_TYPE(decltype(truncf(0)), float);
724 ASSERT_SAME_TYPE(decltype(truncl(0)), long double);
725 ASSERT_SAME_TYPE(decltype(trunc(Ambiguous())), Ambiguous);
726 assert(trunc(1) == 1);
727}
728
729template <class PromoteResult, class Arg = void>
730struct test_single_arg {
731 template <class T = Arg>
732 void operator()() {
733 ASSERT_SAME_TYPE(decltype(::acos(T())), PromoteResult);
734 (void)::acos(T());
735 ASSERT_SAME_TYPE(decltype(::asin(T())), PromoteResult);
736 (void)::asin(T());
737 ASSERT_SAME_TYPE(decltype(::atan(T())), PromoteResult);
738 (void)::atan(T());
739 ASSERT_SAME_TYPE(decltype(::ceil(T())), PromoteResult);
740 (void)::ceil(T());
741 ASSERT_SAME_TYPE(decltype(::cos(T())), PromoteResult);
742 (void)::cos(T());
743 ASSERT_SAME_TYPE(decltype(::cosh(T())), PromoteResult);
744 (void)::cosh(T());
745 ASSERT_SAME_TYPE(decltype(::exp(T())), PromoteResult);
746 (void)::exp(T());
747 ASSERT_SAME_TYPE(decltype(::fabs(T())), PromoteResult);
748 (void)::fabs(T());
749 ASSERT_SAME_TYPE(decltype(::floor(T())), PromoteResult);
750 (void)::floor(T());
751 int ip;
752 ASSERT_SAME_TYPE(decltype(::frexp(T(), &ip)), PromoteResult);
753 (void)::frexp(T(), &ip);
754 ASSERT_SAME_TYPE(decltype(::ldexp(T(), ip)), PromoteResult);
755 (void)::ldexp(T(), ip);
756 ASSERT_SAME_TYPE(decltype(::log(T())), PromoteResult);
757 (void)::log(T());
758 ASSERT_SAME_TYPE(decltype(::log10(T())), PromoteResult);
759 (void)::log10(T());
760 ASSERT_SAME_TYPE(decltype(::sin(T())), PromoteResult);
761 (void)::sin(T());
762 ASSERT_SAME_TYPE(decltype(::sinh(T())), PromoteResult);
763 (void)::sinh(T());
764 ASSERT_SAME_TYPE(decltype(::sqrt(T())), PromoteResult);
765 (void)::sqrt(T());
766 ASSERT_SAME_TYPE(decltype(::tan(T())), PromoteResult);
767 (void)::tan(T());
768 ASSERT_SAME_TYPE(decltype(::tanh(T())), PromoteResult);
769 (void)::tanh(T());
770 ASSERT_SAME_TYPE(decltype(::signbit(T())), bool);
771 (void)::signbit(T());
772 ASSERT_SAME_TYPE(decltype(::fpclassify(T())), int);
773 (void)::fpclassify(T());
774 ASSERT_SAME_TYPE(decltype(::isfinite(T())), bool);
775 (void)::isfinite(T());
776 ASSERT_SAME_TYPE(decltype(::isnormal(T())), bool);
777 (void)::isnormal(T());
778 ASSERT_SAME_TYPE(decltype(::acosh(T())), PromoteResult);
779 (void)::acosh(T());
780 ASSERT_SAME_TYPE(decltype(::asinh(T())), PromoteResult);
781 (void)::asinh(T());
782 ASSERT_SAME_TYPE(decltype(::atanh(T())), PromoteResult);
783 (void)::atanh(T());
784 ASSERT_SAME_TYPE(decltype(::cbrt(T())), PromoteResult);
785 (void)::cbrt(T());
786 ASSERT_SAME_TYPE(decltype(::erf(T())), PromoteResult);
787 (void)::erf(T());
788 ASSERT_SAME_TYPE(decltype(::erfc(T())), PromoteResult);
789 (void)::erfc(T());
790 ASSERT_SAME_TYPE(decltype(::exp2(T())), PromoteResult);
791 (void)::exp2(T());
792 ASSERT_SAME_TYPE(decltype(::expm1(T())), PromoteResult);
793 (void)::expm1(T());
794 ASSERT_SAME_TYPE(decltype(::ilogb(T())), int);
795 (void)::ilogb(T());
796 ASSERT_SAME_TYPE(decltype(::lgamma(T())), PromoteResult);
797 (void)::lgamma(T());
798 ASSERT_SAME_TYPE(decltype(::llrint(T())), long long);
799 (void)::llrint(T());
800 ASSERT_SAME_TYPE(decltype(::llround(T())), long long);
801 (void)::llround(T());
802 ASSERT_SAME_TYPE(decltype(::log1p(T())), PromoteResult);
803 (void)::log1p(T());
804 ASSERT_SAME_TYPE(decltype(::log2(T())), PromoteResult);
805 (void)::log2(T());
806 ASSERT_SAME_TYPE(decltype(::logb(T())), PromoteResult);
807 (void)::logb(T());
808 ASSERT_SAME_TYPE(decltype(::lrint(T())), long);
809 (void)::lrint(T());
810 ASSERT_SAME_TYPE(decltype(::lround(T())), long);
811 (void)::lround(T());
812 ASSERT_SAME_TYPE(decltype(::nearbyint(T())), PromoteResult);
813 (void)::nearbyint(T());
814 ASSERT_SAME_TYPE(decltype(::rint(T())), PromoteResult);
815 (void)::rint(T());
816 ASSERT_SAME_TYPE(decltype(::round(T())), PromoteResult);
817 (void)::round(T());
818 ASSERT_SAME_TYPE(decltype(::trunc(T())), PromoteResult);
819 (void)::trunc(T());
820 ASSERT_SAME_TYPE(decltype(::tgamma(T())), PromoteResult);
821 (void)::tgamma(T());
822 }
823};
824
825template <class PromoteResult, class Arg1 = void, class Arg2 = void>
826struct test_two_args {
827 template <class T = Arg1, class U = Arg2>
828 void operator()() {
829 ASSERT_SAME_TYPE(decltype(::atan2(T(), U())), PromoteResult);
830 (void)::atan2(T(), U());
831 ASSERT_SAME_TYPE(decltype(::fmod(T(), U())), PromoteResult);
832 (void)::fmod(T(), U());
833 ASSERT_SAME_TYPE(decltype(::pow(T(), U())), PromoteResult);
834 (void)::pow(T(), U());
835 ASSERT_SAME_TYPE(decltype(::isgreater(T(), U())), bool);
836 (void)::isgreater(T(), U());
837 ASSERT_SAME_TYPE(decltype(::isgreaterequal(T(), U())), bool);
838 (void)::isgreaterequal(T(), U());
839 ASSERT_SAME_TYPE(decltype(::isless(T(), U())), bool);
840 (void)::isless(T(), U());
841 ASSERT_SAME_TYPE(decltype(::islessequal(T(), U())), bool);
842 (void)::islessequal(T(), U());
843 ASSERT_SAME_TYPE(decltype(::islessgreater(T(), U())), bool);
844 (void)::islessgreater(T(), U());
845 ASSERT_SAME_TYPE(decltype(::isunordered(T(), U())), bool);
846 (void)::isunordered(T(), U());
847 ASSERT_SAME_TYPE(decltype(::copysign(T(), U())), PromoteResult);
848 (void)::copysign(T(), U());
849 ASSERT_SAME_TYPE(decltype(::fdim(T(), U())), PromoteResult);
850 (void)::fdim(T(), U());
851 ASSERT_SAME_TYPE(decltype(::fmax(T(), U())), PromoteResult);
852 (void)::fmax(T(), U());
853 ASSERT_SAME_TYPE(decltype(::fmin(T(), U())), PromoteResult);
854 (void)::fmin(T(), U());
855 ASSERT_SAME_TYPE(decltype(::hypot(T(), U())), PromoteResult);
856 (void)::hypot(T(), U());
857 ASSERT_SAME_TYPE(decltype(::nextafter(T(), U())), PromoteResult);
858 (void)::nextafter(T(), U());
859 ASSERT_SAME_TYPE(decltype(::remainder(T(), U())), PromoteResult);
860 (void)::remainder(T(), U());
861 int ip;
862 ASSERT_SAME_TYPE(decltype(::remquo(T(), U(), &ip)), PromoteResult);
863 ::remquo(T(), U(), &ip);
864 }
865};
866
867template <class PromoteResult, class Arg1 = void, class Arg2 = void, class Arg3 = void>
868struct test_three_args {
869 template <class T = Arg1, class U = Arg2, class V = Arg3>
870 void operator()() {
871 ASSERT_SAME_TYPE(decltype(::fma(T(), U(), V())), PromoteResult);
872 (void)::fma(T(), U(), V());
873 }
874};
875
876struct CallTwoArgs {
877 using integral_float_double = types::concatenate_t<types::integral_types, types::type_list<float, double> >;
878
879 template <class Arg2>
880 void operator()() {
881 types::for_each(integral_float_double(), test_two_args</*PromoteResult=*/double, /*Iterate*/void, Arg2>());
882 }
883};
884
885template <class T>
886struct CallThreeArgs {
887 using integral_float_double = types::concatenate_t<types::integral_types, types::type_list<float, double> >;
888
889 template <class Arg3>
890 struct Helper {
891
892 template <class Arg2>
893 void operator()() {
894 types::for_each(integral_float_double(), test_three_args</*PromoteResult=*/double, /*Iterate*/void, Arg2, Arg3>());
895 }
896 };
897
898 template <class Arg3>
899 void operator()() {
900 types::for_each(integral_float_double(), Helper<Arg3>());
901 }
902};
903
904int main(int, char**) {
905 types::for_each(types::integral_types(), test_single_arg</*PromoteResult=*/double>());
906 test_single_arg</*PromoteResult=*/float, /*Arg=*/float>();
907 test_single_arg</*PromoteResult=*/double, /*Arg=*/double>();
908 test_single_arg</*PromoteResult=*/long double, /*Arg=*/long double>();
909
910 types::for_each(types::integral_types(), CallTwoArgs());
911
912 types::for_each(
913 types::integral_types(), test_two_args</*PromoteResult=*/long double, /*Arg1=*/void, /*Arg2=*/long double>());
914
915 test_two_args</*PromoteResult=*/float, /*Args=*/float, float>();
916 test_two_args</*PromoteResult=*/float, /*Args=*/double, double>();
917 test_two_args</*PromoteResult=*/double, /*Args=*/float, double>();
918 test_two_args</*PromoteResult=*/double, /*Args=*/double, double>();
919
920 types::for_each(types::integral_types(), CallThreeArgs<double>());
921 types::for_each(
922 types::integral_types(), test_three_args</*PromoteResult=*/long double, /*Iterate*/ void, long double, double>());
923
924 test_three_args</*PromoteResult=*/float, /*Args=*/float, float, float>();
925 test_three_args</*PromoteResult=*/double, /*Args=*/double, double, double>();
926 test_three_args</*PromoteResult=*/long double, /*Args=*/long double, long double, long double>();
927
928 test_abs();
929 test_acos();
930 test_asin();
931 test_atan();
932 test_atan2();
933 test_ceil();
934 test_cos();
935 test_cosh();
936 test_exp();
937 test_fabs();
938 test_floor();
939 test_fmod();
940 test_frexp();
941 test_ldexp();
942 test_log();
943 test_log10();
944 test_modf();
945 test_pow();
946 test_sin();
947 test_sinh();
948 test_sqrt();
949 test_tan();
950 test_tanh();
951 test_signbit();
952 test_fpclassify();
953 test_isfinite();
954 test_isnormal();
955 test_isgreater();
956 test_isgreaterequal();
957 test_isinf();
958 test_isless();
959 test_islessequal();
960 test_islessgreater();
961 test_isnan();
962 test_isunordered();
963 test_acosh();
964 test_asinh();
965 test_atanh();
966 test_cbrt();
967 test_copysign();
968 test_erf();
969 test_erfc();
970 test_exp2();
971 test_expm1();
972 test_fdim();
973 test_fma();
974 test_fmax();
975 test_fmin();
976 test_hypot();
977 test_ilogb();
978 test_lgamma();
979 test_llrint();
980 test_llround();
981 test_log1p();
982 test_log2();
983 test_logb();
984 test_lrint();
985 test_lround();
986 test_nan();
987 test_nearbyint();
988 test_nextafter();
989 test_nexttoward();
990 test_remainder();
991 test_remquo();
992 test_rint();
993 test_round();
994 test_scalbln();
995 test_scalbn();
996 test_tgamma();
997 test_trunc();
998
999 return 0;
1000}
1001

source code of libcxx/test/std/depr/depr.c.headers/math_h.pass.cpp