]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/include/c_global/cmath
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / include / c_global / cmath
CommitLineData
af13a7a6
BK
1// -*- C++ -*- C forwarding header.
2
a5544970 3// Copyright (C) 1997-2019 Free Software Foundation, Inc.
af13a7a6
BK
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
748086b7 8// Free Software Foundation; either version 3, or (at your option)
af13a7a6
BK
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
748086b7
JJ
16// Under Section 7 of GPL version 3, you are granted additional
17// permissions described in the GCC Runtime Library Exception, version
18// 3.1, as published by the Free Software Foundation.
af13a7a6 19
748086b7
JJ
20// You should have received a copy of the GNU General Public License and
21// a copy of the GCC Runtime Library Exception along with this program;
22// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23// <http://www.gnu.org/licenses/>.
af13a7a6
BK
24
25/** @file include/cmath
8e32aa11 26 * This is a Standard C++ Library file. You should @c \#include this file
2a60a9f6 27 * in your programs, rather than any of the @a *.h implementation files.
af13a7a6
BK
28 *
29 * This is the C++ version of the Standard C Library header @c math.h,
30 * and its contents are (mostly) the same as that header, but are all
31 * contained in the namespace @c std (except for names which are defined
32 * as macros in C).
33 */
34
35//
36// ISO C++ 14882: 26.5 C library
37//
38
39#pragma GCC system_header
40
41#include <bits/c++config.h>
42#include <bits/cpp_type_traits.h>
43#include <ext/type_traits.h>
96e19ada
JW
44#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
45#include_next <math.h>
46#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
37b204de 47#include <bits/std_abs.h>
af13a7a6
BK
48
49#ifndef _GLIBCXX_CMATH
50#define _GLIBCXX_CMATH 1
51
52// Get rid of those macros defined in <math.h> in lieu of real functions.
af13a7a6
BK
53#undef div
54#undef acos
55#undef asin
56#undef atan
57#undef atan2
58#undef ceil
59#undef cos
60#undef cosh
61#undef exp
62#undef fabs
63#undef floor
64#undef fmod
65#undef frexp
66#undef ldexp
67#undef log
68#undef log10
69#undef modf
70#undef pow
71#undef sin
72#undef sinh
73#undef sqrt
74#undef tan
75#undef tanh
76
eac437bf
JW
77extern "C++"
78{
12ffa228
BK
79namespace std _GLIBCXX_VISIBILITY(default)
80{
81_GLIBCXX_BEGIN_NAMESPACE_VERSION
af13a7a6 82
af13a7a6
BK
83 using ::acos;
84
7888f266 85#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 86 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
87 acos(float __x)
88 { return __builtin_acosf(__x); }
89
fa459900 90 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
91 acos(long double __x)
92 { return __builtin_acosl(__x); }
a1998fab 93#endif
af13a7a6
BK
94
95 template<typename _Tp>
fa459900
PC
96 inline _GLIBCXX_CONSTEXPR
97 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
98 double>::__type
af13a7a6
BK
99 acos(_Tp __x)
100 { return __builtin_acos(__x); }
101
102 using ::asin;
103
7888f266 104#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 105 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
106 asin(float __x)
107 { return __builtin_asinf(__x); }
108
fa459900 109 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
110 asin(long double __x)
111 { return __builtin_asinl(__x); }
a1998fab 112#endif
af13a7a6
BK
113
114 template<typename _Tp>
fa459900
PC
115 inline _GLIBCXX_CONSTEXPR
116 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
117 double>::__type
af13a7a6
BK
118 asin(_Tp __x)
119 { return __builtin_asin(__x); }
120
121 using ::atan;
122
7888f266 123#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 124 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
125 atan(float __x)
126 { return __builtin_atanf(__x); }
127
fa459900 128 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
129 atan(long double __x)
130 { return __builtin_atanl(__x); }
a1998fab 131#endif
af13a7a6
BK
132
133 template<typename _Tp>
fa459900
PC
134 inline _GLIBCXX_CONSTEXPR
135 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
136 double>::__type
af13a7a6
BK
137 atan(_Tp __x)
138 { return __builtin_atan(__x); }
139
140 using ::atan2;
141
7888f266 142#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 143 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
144 atan2(float __y, float __x)
145 { return __builtin_atan2f(__y, __x); }
146
fa459900 147 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
148 atan2(long double __y, long double __x)
149 { return __builtin_atan2l(__y, __x); }
a1998fab 150#endif
af13a7a6
BK
151
152 template<typename _Tp, typename _Up>
fa459900 153 inline _GLIBCXX_CONSTEXPR
9fb29828 154 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
af13a7a6 155 atan2(_Tp __y, _Up __x)
e133ace8
PC
156 {
157 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
158 return atan2(__type(__y), __type(__x));
159 }
af13a7a6
BK
160
161 using ::ceil;
162
7888f266 163#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 164 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
165 ceil(float __x)
166 { return __builtin_ceilf(__x); }
167
fa459900 168 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
169 ceil(long double __x)
170 { return __builtin_ceill(__x); }
a1998fab 171#endif
af13a7a6
BK
172
173 template<typename _Tp>
fa459900
PC
174 inline _GLIBCXX_CONSTEXPR
175 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
176 double>::__type
af13a7a6
BK
177 ceil(_Tp __x)
178 { return __builtin_ceil(__x); }
179
180 using ::cos;
181
7888f266 182#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 183 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
184 cos(float __x)
185 { return __builtin_cosf(__x); }
186
fa459900 187 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
188 cos(long double __x)
189 { return __builtin_cosl(__x); }
a1998fab 190#endif
af13a7a6
BK
191
192 template<typename _Tp>
fa459900
PC
193 inline _GLIBCXX_CONSTEXPR
194 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
195 double>::__type
af13a7a6
BK
196 cos(_Tp __x)
197 { return __builtin_cos(__x); }
198
199 using ::cosh;
200
7888f266 201#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 202 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
203 cosh(float __x)
204 { return __builtin_coshf(__x); }
205
fa459900 206 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
207 cosh(long double __x)
208 { return __builtin_coshl(__x); }
a1998fab 209#endif
af13a7a6
BK
210
211 template<typename _Tp>
fa459900
PC
212 inline _GLIBCXX_CONSTEXPR
213 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
214 double>::__type
af13a7a6
BK
215 cosh(_Tp __x)
216 { return __builtin_cosh(__x); }
217
218 using ::exp;
219
7888f266 220#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 221 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
222 exp(float __x)
223 { return __builtin_expf(__x); }
224
fa459900 225 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
226 exp(long double __x)
227 { return __builtin_expl(__x); }
a1998fab 228#endif
af13a7a6
BK
229
230 template<typename _Tp>
fa459900
PC
231 inline _GLIBCXX_CONSTEXPR
232 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
233 double>::__type
af13a7a6
BK
234 exp(_Tp __x)
235 { return __builtin_exp(__x); }
236
237 using ::fabs;
238
7888f266 239#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 240 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
241 fabs(float __x)
242 { return __builtin_fabsf(__x); }
243
fa459900 244 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
245 fabs(long double __x)
246 { return __builtin_fabsl(__x); }
a1998fab 247#endif
af13a7a6
BK
248
249 template<typename _Tp>
fa459900
PC
250 inline _GLIBCXX_CONSTEXPR
251 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
252 double>::__type
af13a7a6
BK
253 fabs(_Tp __x)
254 { return __builtin_fabs(__x); }
255
256 using ::floor;
257
7888f266 258#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 259 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
260 floor(float __x)
261 { return __builtin_floorf(__x); }
262
fa459900 263 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
264 floor(long double __x)
265 { return __builtin_floorl(__x); }
a1998fab 266#endif
af13a7a6
BK
267
268 template<typename _Tp>
fa459900
PC
269 inline _GLIBCXX_CONSTEXPR
270 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
271 double>::__type
af13a7a6
BK
272 floor(_Tp __x)
273 { return __builtin_floor(__x); }
274
275 using ::fmod;
276
7888f266 277#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 278 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
279 fmod(float __x, float __y)
280 { return __builtin_fmodf(__x, __y); }
281
fa459900 282 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
283 fmod(long double __x, long double __y)
284 { return __builtin_fmodl(__x, __y); }
a1998fab 285#endif
af13a7a6 286
e02d979a
PC
287 template<typename _Tp, typename _Up>
288 inline _GLIBCXX_CONSTEXPR
9fb29828 289 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
e02d979a
PC
290 fmod(_Tp __x, _Up __y)
291 {
292 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
293 return fmod(__type(__x), __type(__y));
294 }
295
af13a7a6
BK
296 using ::frexp;
297
7888f266 298#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
77addcb7 299 inline float
af13a7a6
BK
300 frexp(float __x, int* __exp)
301 { return __builtin_frexpf(__x, __exp); }
302
77addcb7 303 inline long double
af13a7a6
BK
304 frexp(long double __x, int* __exp)
305 { return __builtin_frexpl(__x, __exp); }
a1998fab 306#endif
af13a7a6
BK
307
308 template<typename _Tp>
fa459900
PC
309 inline _GLIBCXX_CONSTEXPR
310 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
311 double>::__type
af13a7a6
BK
312 frexp(_Tp __x, int* __exp)
313 { return __builtin_frexp(__x, __exp); }
314
315 using ::ldexp;
316
7888f266 317#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 318 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
319 ldexp(float __x, int __exp)
320 { return __builtin_ldexpf(__x, __exp); }
321
fa459900 322 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
323 ldexp(long double __x, int __exp)
324 { return __builtin_ldexpl(__x, __exp); }
a1998fab 325#endif
af13a7a6
BK
326
327 template<typename _Tp>
fa459900
PC
328 inline _GLIBCXX_CONSTEXPR
329 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
330 double>::__type
e02d979a
PC
331 ldexp(_Tp __x, int __exp)
332 { return __builtin_ldexp(__x, __exp); }
af13a7a6
BK
333
334 using ::log;
335
7888f266 336#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 337 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
338 log(float __x)
339 { return __builtin_logf(__x); }
340
fa459900 341 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
342 log(long double __x)
343 { return __builtin_logl(__x); }
a1998fab 344#endif
af13a7a6
BK
345
346 template<typename _Tp>
fa459900
PC
347 inline _GLIBCXX_CONSTEXPR
348 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
349 double>::__type
af13a7a6
BK
350 log(_Tp __x)
351 { return __builtin_log(__x); }
352
353 using ::log10;
354
7888f266 355#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 356 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
357 log10(float __x)
358 { return __builtin_log10f(__x); }
359
fa459900 360 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
361 log10(long double __x)
362 { return __builtin_log10l(__x); }
a1998fab 363#endif
af13a7a6
BK
364
365 template<typename _Tp>
fa459900
PC
366 inline _GLIBCXX_CONSTEXPR
367 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
368 double>::__type
af13a7a6
BK
369 log10(_Tp __x)
370 { return __builtin_log10(__x); }
371
372 using ::modf;
373
7888f266 374#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
77addcb7 375 inline float
af13a7a6
BK
376 modf(float __x, float* __iptr)
377 { return __builtin_modff(__x, __iptr); }
378
77addcb7 379 inline long double
af13a7a6
BK
380 modf(long double __x, long double* __iptr)
381 { return __builtin_modfl(__x, __iptr); }
a1998fab 382#endif
af13a7a6 383
af13a7a6
BK
384 using ::pow;
385
7888f266 386#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 387 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
388 pow(float __x, float __y)
389 { return __builtin_powf(__x, __y); }
390
fa459900 391 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
392 pow(long double __x, long double __y)
393 { return __builtin_powl(__x, __y); }
394
734f5023 395#if __cplusplus < 201103L
774c3d86
PC
396 // _GLIBCXX_RESOLVE_LIB_DEFECTS
397 // DR 550. What should the return type of pow(float,int) be?
af13a7a6
BK
398 inline double
399 pow(double __x, int __i)
400 { return __builtin_powi(__x, __i); }
401
402 inline float
403 pow(float __x, int __n)
404 { return __builtin_powif(__x, __n); }
405
406 inline long double
407 pow(long double __x, int __n)
408 { return __builtin_powil(__x, __n); }
a1998fab 409#endif
774c3d86 410#endif
af13a7a6 411
e133ace8 412 template<typename _Tp, typename _Up>
fa459900 413 inline _GLIBCXX_CONSTEXPR
9fb29828 414 typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
e133ace8
PC
415 pow(_Tp __x, _Up __y)
416 {
417 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
418 return pow(__type(__x), __type(__y));
419 }
420
af13a7a6
BK
421 using ::sin;
422
7888f266 423#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 424 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
425 sin(float __x)
426 { return __builtin_sinf(__x); }
427
fa459900 428 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
429 sin(long double __x)
430 { return __builtin_sinl(__x); }
a1998fab 431#endif
af13a7a6
BK
432
433 template<typename _Tp>
fa459900
PC
434 inline _GLIBCXX_CONSTEXPR
435 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
436 double>::__type
af13a7a6
BK
437 sin(_Tp __x)
438 { return __builtin_sin(__x); }
439
440 using ::sinh;
441
7888f266 442#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 443 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
444 sinh(float __x)
445 { return __builtin_sinhf(__x); }
446
fa459900 447 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
448 sinh(long double __x)
449 { return __builtin_sinhl(__x); }
a1998fab 450#endif
af13a7a6
BK
451
452 template<typename _Tp>
fa459900
PC
453 inline _GLIBCXX_CONSTEXPR
454 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
455 double>::__type
af13a7a6
BK
456 sinh(_Tp __x)
457 { return __builtin_sinh(__x); }
458
459 using ::sqrt;
460
7888f266 461#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 462 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
463 sqrt(float __x)
464 { return __builtin_sqrtf(__x); }
465
fa459900 466 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
467 sqrt(long double __x)
468 { return __builtin_sqrtl(__x); }
a1998fab 469#endif
af13a7a6
BK
470
471 template<typename _Tp>
fa459900
PC
472 inline _GLIBCXX_CONSTEXPR
473 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
474 double>::__type
af13a7a6
BK
475 sqrt(_Tp __x)
476 { return __builtin_sqrt(__x); }
477
478 using ::tan;
479
7888f266 480#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 481 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
482 tan(float __x)
483 { return __builtin_tanf(__x); }
484
fa459900 485 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
486 tan(long double __x)
487 { return __builtin_tanl(__x); }
a1998fab 488#endif
af13a7a6
BK
489
490 template<typename _Tp>
fa459900
PC
491 inline _GLIBCXX_CONSTEXPR
492 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
493 double>::__type
af13a7a6
BK
494 tan(_Tp __x)
495 { return __builtin_tan(__x); }
496
497 using ::tanh;
498
7888f266 499#ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
fa459900 500 inline _GLIBCXX_CONSTEXPR float
af13a7a6
BK
501 tanh(float __x)
502 { return __builtin_tanhf(__x); }
503
fa459900 504 inline _GLIBCXX_CONSTEXPR long double
af13a7a6
BK
505 tanh(long double __x)
506 { return __builtin_tanhl(__x); }
a1998fab 507#endif
af13a7a6
BK
508
509 template<typename _Tp>
fa459900
PC
510 inline _GLIBCXX_CONSTEXPR
511 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
512 double>::__type
af13a7a6
BK
513 tanh(_Tp __x)
514 { return __builtin_tanh(__x); }
515
af13a7a6
BK
516#if _GLIBCXX_USE_C99_MATH
517#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
af13a7a6 518
57317d2a 519// These are possible macros imported from C99-land.
af13a7a6
BK
520#undef fpclassify
521#undef isfinite
522#undef isinf
523#undef isnan
524#undef isnormal
525#undef signbit
526#undef isgreater
527#undef isgreaterequal
528#undef isless
529#undef islessequal
530#undef islessgreater
531#undef isunordered
532
734f5023 533#if __cplusplus >= 201103L
ef3a7506 534
3115f94f 535#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 536 constexpr int
77fd1c1d
PC
537 fpclassify(float __x)
538 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
539 FP_SUBNORMAL, FP_ZERO, __x); }
540
fa459900 541 constexpr int
77fd1c1d
PC
542 fpclassify(double __x)
543 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
544 FP_SUBNORMAL, FP_ZERO, __x); }
545
fa459900 546 constexpr int
77fd1c1d
PC
547 fpclassify(long double __x)
548 { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
549 FP_SUBNORMAL, FP_ZERO, __x); }
ef3a7506 550#endif
77fd1c1d 551
3115f94f 552#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 553 template<typename _Tp>
fa459900
PC
554 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
555 int>::__type
77fd1c1d
PC
556 fpclassify(_Tp __x)
557 { return __x != 0 ? FP_NORMAL : FP_ZERO; }
3115f94f 558#endif
77fd1c1d 559
3115f94f 560#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 561 constexpr bool
77fd1c1d
PC
562 isfinite(float __x)
563 { return __builtin_isfinite(__x); }
564
fa459900 565 constexpr bool
77fd1c1d
PC
566 isfinite(double __x)
567 { return __builtin_isfinite(__x); }
568
fa459900 569 constexpr bool
77fd1c1d
PC
570 isfinite(long double __x)
571 { return __builtin_isfinite(__x); }
ef3a7506 572#endif
77fd1c1d 573
3115f94f 574#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 575 template<typename _Tp>
fa459900
PC
576 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
577 bool>::__type
77fd1c1d
PC
578 isfinite(_Tp __x)
579 { return true; }
3115f94f 580#endif
77fd1c1d 581
3115f94f 582#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 583 constexpr bool
77fd1c1d 584 isinf(float __x)
750867b7 585 { return __builtin_isinf(__x); }
77fd1c1d 586
69b0daeb 587#if _GLIBCXX_HAVE_OBSOLETE_ISINF \
350fe282 588 && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
39a1d8c8
JW
589 using ::isinf;
590#else
fa459900 591 constexpr bool
77fd1c1d 592 isinf(double __x)
750867b7 593 { return __builtin_isinf(__x); }
39a1d8c8 594#endif
77fd1c1d 595
fa459900 596 constexpr bool
77fd1c1d 597 isinf(long double __x)
750867b7 598 { return __builtin_isinf(__x); }
ef3a7506 599#endif
77fd1c1d 600
3115f94f 601#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 602 template<typename _Tp>
fa459900
PC
603 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
604 bool>::__type
77fd1c1d
PC
605 isinf(_Tp __x)
606 { return false; }
3115f94f 607#endif
77fd1c1d 608
3115f94f 609#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 610 constexpr bool
77fd1c1d
PC
611 isnan(float __x)
612 { return __builtin_isnan(__x); }
613
69b0daeb 614#if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
350fe282 615 && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
39a1d8c8
JW
616 using ::isnan;
617#else
fa459900 618 constexpr bool
77fd1c1d
PC
619 isnan(double __x)
620 { return __builtin_isnan(__x); }
39a1d8c8 621#endif
77fd1c1d 622
fa459900 623 constexpr bool
77fd1c1d
PC
624 isnan(long double __x)
625 { return __builtin_isnan(__x); }
ef3a7506 626#endif
77fd1c1d 627
3115f94f 628#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 629 template<typename _Tp>
fa459900
PC
630 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
631 bool>::__type
77fd1c1d
PC
632 isnan(_Tp __x)
633 { return false; }
3115f94f 634#endif
77fd1c1d 635
3115f94f 636#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 637 constexpr bool
77fd1c1d
PC
638 isnormal(float __x)
639 { return __builtin_isnormal(__x); }
640
fa459900 641 constexpr bool
77fd1c1d
PC
642 isnormal(double __x)
643 { return __builtin_isnormal(__x); }
644
fa459900 645 constexpr bool
77fd1c1d
PC
646 isnormal(long double __x)
647 { return __builtin_isnormal(__x); }
ef3a7506 648#endif
77fd1c1d 649
3115f94f 650#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 651 template<typename _Tp>
fa459900
PC
652 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
653 bool>::__type
77fd1c1d
PC
654 isnormal(_Tp __x)
655 { return __x != 0 ? true : false; }
3115f94f 656#endif
77fd1c1d 657
3115f94f 658#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
dce573c4 659 // Note: middle-end/36757 is fixed, __builtin_signbit is type-generic.
fa459900 660 constexpr bool
77fd1c1d 661 signbit(float __x)
157177af 662 { return __builtin_signbit(__x); }
77fd1c1d 663
fa459900 664 constexpr bool
77fd1c1d
PC
665 signbit(double __x)
666 { return __builtin_signbit(__x); }
667
fa459900 668 constexpr bool
77fd1c1d 669 signbit(long double __x)
157177af 670 { return __builtin_signbit(__x); }
ef3a7506 671#endif
77fd1c1d 672
3115f94f 673#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 674 template<typename _Tp>
fa459900
PC
675 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
676 bool>::__type
77fd1c1d
PC
677 signbit(_Tp __x)
678 { return __x < 0 ? true : false; }
3115f94f 679#endif
77fd1c1d 680
3115f94f 681#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 682 constexpr bool
77fd1c1d
PC
683 isgreater(float __x, float __y)
684 { return __builtin_isgreater(__x, __y); }
685
fa459900 686 constexpr bool
77fd1c1d
PC
687 isgreater(double __x, double __y)
688 { return __builtin_isgreater(__x, __y); }
689
fa459900 690 constexpr bool
77fd1c1d
PC
691 isgreater(long double __x, long double __y)
692 { return __builtin_isgreater(__x, __y); }
ef3a7506 693#endif
77fd1c1d 694
3115f94f 695#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 696 template<typename _Tp, typename _Up>
fa459900 697 constexpr typename
77fd1c1d
PC
698 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
699 && __is_arithmetic<_Up>::__value), bool>::__type
700 isgreater(_Tp __x, _Up __y)
701 {
702 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
703 return __builtin_isgreater(__type(__x), __type(__y));
704 }
3115f94f 705#endif
77fd1c1d 706
3115f94f 707#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 708 constexpr bool
77fd1c1d
PC
709 isgreaterequal(float __x, float __y)
710 { return __builtin_isgreaterequal(__x, __y); }
711
fa459900 712 constexpr bool
77fd1c1d
PC
713 isgreaterequal(double __x, double __y)
714 { return __builtin_isgreaterequal(__x, __y); }
715
fa459900 716 constexpr bool
77fd1c1d
PC
717 isgreaterequal(long double __x, long double __y)
718 { return __builtin_isgreaterequal(__x, __y); }
ef3a7506 719#endif
77fd1c1d 720
3115f94f 721#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 722 template<typename _Tp, typename _Up>
fa459900 723 constexpr typename
77fd1c1d
PC
724 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
725 && __is_arithmetic<_Up>::__value), bool>::__type
726 isgreaterequal(_Tp __x, _Up __y)
727 {
728 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
729 return __builtin_isgreaterequal(__type(__x), __type(__y));
730 }
3115f94f 731#endif
77fd1c1d 732
3115f94f 733#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 734 constexpr bool
77fd1c1d
PC
735 isless(float __x, float __y)
736 { return __builtin_isless(__x, __y); }
737
fa459900 738 constexpr bool
77fd1c1d
PC
739 isless(double __x, double __y)
740 { return __builtin_isless(__x, __y); }
741
fa459900 742 constexpr bool
77fd1c1d
PC
743 isless(long double __x, long double __y)
744 { return __builtin_isless(__x, __y); }
ef3a7506 745#endif
77fd1c1d 746
3115f94f 747#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 748 template<typename _Tp, typename _Up>
fa459900 749 constexpr typename
77fd1c1d
PC
750 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
751 && __is_arithmetic<_Up>::__value), bool>::__type
752 isless(_Tp __x, _Up __y)
753 {
754 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
755 return __builtin_isless(__type(__x), __type(__y));
756 }
3115f94f 757#endif
77fd1c1d 758
3115f94f 759#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 760 constexpr bool
77fd1c1d
PC
761 islessequal(float __x, float __y)
762 { return __builtin_islessequal(__x, __y); }
763
fa459900 764 constexpr bool
77fd1c1d
PC
765 islessequal(double __x, double __y)
766 { return __builtin_islessequal(__x, __y); }
767
fa459900 768 constexpr bool
77fd1c1d
PC
769 islessequal(long double __x, long double __y)
770 { return __builtin_islessequal(__x, __y); }
ef3a7506 771#endif
77fd1c1d 772
3115f94f 773#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 774 template<typename _Tp, typename _Up>
fa459900 775 constexpr typename
77fd1c1d
PC
776 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
777 && __is_arithmetic<_Up>::__value), bool>::__type
778 islessequal(_Tp __x, _Up __y)
779 {
780 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
781 return __builtin_islessequal(__type(__x), __type(__y));
782 }
3115f94f 783#endif
77fd1c1d 784
3115f94f 785#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 786 constexpr bool
77fd1c1d
PC
787 islessgreater(float __x, float __y)
788 { return __builtin_islessgreater(__x, __y); }
789
fa459900 790 constexpr bool
77fd1c1d
PC
791 islessgreater(double __x, double __y)
792 { return __builtin_islessgreater(__x, __y); }
793
fa459900 794 constexpr bool
77fd1c1d
PC
795 islessgreater(long double __x, long double __y)
796 { return __builtin_islessgreater(__x, __y); }
ef3a7506 797#endif
77fd1c1d 798
3115f94f 799#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 800 template<typename _Tp, typename _Up>
fa459900 801 constexpr typename
77fd1c1d
PC
802 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
803 && __is_arithmetic<_Up>::__value), bool>::__type
804 islessgreater(_Tp __x, _Up __y)
805 {
806 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
807 return __builtin_islessgreater(__type(__x), __type(__y));
808 }
3115f94f 809#endif
77fd1c1d 810
3115f94f 811#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 812 constexpr bool
77fd1c1d
PC
813 isunordered(float __x, float __y)
814 { return __builtin_isunordered(__x, __y); }
815
fa459900 816 constexpr bool
77fd1c1d
PC
817 isunordered(double __x, double __y)
818 { return __builtin_isunordered(__x, __y); }
819
fa459900 820 constexpr bool
77fd1c1d
PC
821 isunordered(long double __x, long double __y)
822 { return __builtin_isunordered(__x, __y); }
ef3a7506 823#endif
77fd1c1d 824
3115f94f 825#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
77fd1c1d 826 template<typename _Tp, typename _Up>
fa459900 827 constexpr typename
77fd1c1d
PC
828 __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
829 && __is_arithmetic<_Up>::__value), bool>::__type
830 isunordered(_Tp __x, _Up __y)
831 {
832 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
833 return __builtin_isunordered(__type(__x), __type(__y));
834 }
3115f94f 835#endif
77fd1c1d
PC
836
837#else
838
af13a7a6 839 template<typename _Tp>
0e7edcd5
PC
840 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
841 int>::__type
842 fpclassify(_Tp __f)
843 {
844 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
ebd15f80
PC
845 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
846 FP_SUBNORMAL, FP_ZERO, __type(__f));
0e7edcd5 847 }
af13a7a6
BK
848
849 template<typename _Tp>
0e7edcd5
PC
850 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
851 int>::__type
852 isfinite(_Tp __f)
853 {
854 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
855 return __builtin_isfinite(__type(__f));
856 }
af13a7a6
BK
857
858 template<typename _Tp>
0e7edcd5
PC
859 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
860 int>::__type
861 isinf(_Tp __f)
862 {
863 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
864 return __builtin_isinf(__type(__f));
865 }
af13a7a6
BK
866
867 template<typename _Tp>
0e7edcd5
PC
868 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
869 int>::__type
870 isnan(_Tp __f)
871 {
872 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
873 return __builtin_isnan(__type(__f));
874 }
af13a7a6
BK
875
876 template<typename _Tp>
0e7edcd5
PC
877 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
878 int>::__type
879 isnormal(_Tp __f)
880 {
881 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
882 return __builtin_isnormal(__type(__f));
883 }
af13a7a6
BK
884
885 template<typename _Tp>
0e7edcd5
PC
886 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
887 int>::__type
888 signbit(_Tp __f)
889 {
890 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
891 return __builtin_signbit(__type(__f));
892 }
af13a7a6
BK
893
894 template<typename _Tp>
0e7edcd5
PC
895 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
896 int>::__type
af13a7a6 897 isgreater(_Tp __f1, _Tp __f2)
0e7edcd5
PC
898 {
899 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
900 return __builtin_isgreater(__type(__f1), __type(__f2));
901 }
af13a7a6
BK
902
903 template<typename _Tp>
0e7edcd5
PC
904 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
905 int>::__type
af13a7a6 906 isgreaterequal(_Tp __f1, _Tp __f2)
0e7edcd5
PC
907 {
908 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
909 return __builtin_isgreaterequal(__type(__f1), __type(__f2));
910 }
af13a7a6
BK
911
912 template<typename _Tp>
0e7edcd5
PC
913 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
914 int>::__type
af13a7a6 915 isless(_Tp __f1, _Tp __f2)
0e7edcd5
PC
916 {
917 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
918 return __builtin_isless(__type(__f1), __type(__f2));
919 }
af13a7a6
BK
920
921 template<typename _Tp>
0e7edcd5
PC
922 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
923 int>::__type
af13a7a6 924 islessequal(_Tp __f1, _Tp __f2)
0e7edcd5
PC
925 {
926 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
927 return __builtin_islessequal(__type(__f1), __type(__f2));
928 }
af13a7a6
BK
929
930 template<typename _Tp>
0e7edcd5
PC
931 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
932 int>::__type
af13a7a6 933 islessgreater(_Tp __f1, _Tp __f2)
0e7edcd5
PC
934 {
935 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
936 return __builtin_islessgreater(__type(__f1), __type(__f2));
937 }
af13a7a6
BK
938
939 template<typename _Tp>
0e7edcd5
PC
940 inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
941 int>::__type
af13a7a6 942 isunordered(_Tp __f1, _Tp __f2)
0e7edcd5
PC
943 {
944 typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
945 return __builtin_isunordered(__type(__f1), __type(__f2));
946 }
af13a7a6 947
4a15d842 948#endif // C++11
af13a7a6 949#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
4a15d842 950#endif /* _GLIBCXX_USE_C99_MATH */
af13a7a6 951
734f5023 952#if __cplusplus >= 201103L
53dc5044
PC
953
954#ifdef _GLIBCXX_USE_C99_MATH_TR1
955
956#undef acosh
957#undef acoshf
958#undef acoshl
959#undef asinh
960#undef asinhf
961#undef asinhl
962#undef atanh
963#undef atanhf
964#undef atanhl
965#undef cbrt
966#undef cbrtf
967#undef cbrtl
968#undef copysign
969#undef copysignf
970#undef copysignl
971#undef erf
972#undef erff
973#undef erfl
974#undef erfc
975#undef erfcf
976#undef erfcl
977#undef exp2
978#undef exp2f
979#undef exp2l
980#undef expm1
981#undef expm1f
982#undef expm1l
983#undef fdim
984#undef fdimf
985#undef fdiml
986#undef fma
987#undef fmaf
988#undef fmal
989#undef fmax
990#undef fmaxf
991#undef fmaxl
992#undef fmin
993#undef fminf
994#undef fminl
995#undef hypot
996#undef hypotf
997#undef hypotl
998#undef ilogb
999#undef ilogbf
1000#undef ilogbl
1001#undef lgamma
1002#undef lgammaf
1003#undef lgammal
a7765de8 1004#ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
53dc5044
PC
1005#undef llrint
1006#undef llrintf
1007#undef llrintl
1008#undef llround
1009#undef llroundf
1010#undef llroundl
a7765de8 1011#endif
53dc5044
PC
1012#undef log1p
1013#undef log1pf
1014#undef log1pl
1015#undef log2
1016#undef log2f
1017#undef log2l
1018#undef logb
1019#undef logbf
1020#undef logbl
1021#undef lrint
1022#undef lrintf
1023#undef lrintl
1024#undef lround
1025#undef lroundf
1026#undef lroundl
1027#undef nan
1028#undef nanf
1029#undef nanl
1030#undef nearbyint
1031#undef nearbyintf
1032#undef nearbyintl
1033#undef nextafter
1034#undef nextafterf
1035#undef nextafterl
1036#undef nexttoward
1037#undef nexttowardf
1038#undef nexttowardl
1039#undef remainder
1040#undef remainderf
1041#undef remainderl
1042#undef remquo
1043#undef remquof
1044#undef remquol
1045#undef rint
1046#undef rintf
1047#undef rintl
1048#undef round
1049#undef roundf
1050#undef roundl
1051#undef scalbln
1052#undef scalblnf
1053#undef scalblnl
1054#undef scalbn
1055#undef scalbnf
1056#undef scalbnl
1057#undef tgamma
1058#undef tgammaf
1059#undef tgammal
1060#undef trunc
1061#undef truncf
1062#undef truncl
1063
53dc5044
PC
1064 // types
1065 using ::double_t;
1066 using ::float_t;
1067
1068 // functions
1069 using ::acosh;
1070 using ::acoshf;
1071 using ::acoshl;
1072
1073 using ::asinh;
1074 using ::asinhf;
1075 using ::asinhl;
1076
1077 using ::atanh;
1078 using ::atanhf;
1079 using ::atanhl;
1080
1081 using ::cbrt;
1082 using ::cbrtf;
1083 using ::cbrtl;
1084
1085 using ::copysign;
1086 using ::copysignf;
1087 using ::copysignl;
1088
1089 using ::erf;
1090 using ::erff;
1091 using ::erfl;
1092
1093 using ::erfc;
1094 using ::erfcf;
1095 using ::erfcl;
1096
1097 using ::exp2;
1098 using ::exp2f;
1099 using ::exp2l;
1100
1101 using ::expm1;
1102 using ::expm1f;
1103 using ::expm1l;
1104
1105 using ::fdim;
1106 using ::fdimf;
1107 using ::fdiml;
1108
1109 using ::fma;
1110 using ::fmaf;
1111 using ::fmal;
1112
1113 using ::fmax;
1114 using ::fmaxf;
1115 using ::fmaxl;
1116
1117 using ::fmin;
1118 using ::fminf;
1119 using ::fminl;
1120
1121 using ::hypot;
1122 using ::hypotf;
1123 using ::hypotl;
1124
1125 using ::ilogb;
1126 using ::ilogbf;
1127 using ::ilogbl;
1128
1129 using ::lgamma;
1130 using ::lgammaf;
1131 using ::lgammal;
1132
a7765de8 1133#ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
53dc5044
PC
1134 using ::llrint;
1135 using ::llrintf;
1136 using ::llrintl;
1137
1138 using ::llround;
1139 using ::llroundf;
1140 using ::llroundl;
a7765de8 1141#endif
53dc5044
PC
1142
1143 using ::log1p;
1144 using ::log1pf;
1145 using ::log1pl;
1146
1147 using ::log2;
1148 using ::log2f;
1149 using ::log2l;
1150
1151 using ::logb;
1152 using ::logbf;
1153 using ::logbl;
1154
1155 using ::lrint;
1156 using ::lrintf;
1157 using ::lrintl;
1158
1159 using ::lround;
1160 using ::lroundf;
1161 using ::lroundl;
1162
1163 using ::nan;
1164 using ::nanf;
1165 using ::nanl;
1166
1167 using ::nearbyint;
1168 using ::nearbyintf;
1169 using ::nearbyintl;
1170
1171 using ::nextafter;
1172 using ::nextafterf;
1173 using ::nextafterl;
1174
1175 using ::nexttoward;
1176 using ::nexttowardf;
1177 using ::nexttowardl;
1178
1179 using ::remainder;
1180 using ::remainderf;
1181 using ::remainderl;
1182
1183 using ::remquo;
1184 using ::remquof;
1185 using ::remquol;
1186
1187 using ::rint;
1188 using ::rintf;
1189 using ::rintl;
1190
1191 using ::round;
1192 using ::roundf;
1193 using ::roundl;
1194
1195 using ::scalbln;
1196 using ::scalblnf;
1197 using ::scalblnl;
1198
1199 using ::scalbn;
1200 using ::scalbnf;
1201 using ::scalbnl;
1202
1203 using ::tgamma;
1204 using ::tgammaf;
1205 using ::tgammal;
1206
1207 using ::trunc;
1208 using ::truncf;
1209 using ::truncl;
1210
298cee01 1211 /// Additional overloads.
3115f94f 1212#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1213 constexpr float
53dc5044
PC
1214 acosh(float __x)
1215 { return __builtin_acoshf(__x); }
1216
fa459900 1217 constexpr long double
53dc5044
PC
1218 acosh(long double __x)
1219 { return __builtin_acoshl(__x); }
ef3a7506 1220#endif
53dc5044 1221
3115f94f 1222#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1223 template<typename _Tp>
fa459900
PC
1224 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1225 double>::__type
53dc5044 1226 acosh(_Tp __x)
b04fa738 1227 { return __builtin_acosh(__x); }
3115f94f 1228#endif
53dc5044 1229
3115f94f 1230#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1231 constexpr float
53dc5044
PC
1232 asinh(float __x)
1233 { return __builtin_asinhf(__x); }
1234
fa459900 1235 constexpr long double
53dc5044
PC
1236 asinh(long double __x)
1237 { return __builtin_asinhl(__x); }
ef3a7506 1238#endif
53dc5044 1239
3115f94f 1240#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1241 template<typename _Tp>
fa459900
PC
1242 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1243 double>::__type
53dc5044 1244 asinh(_Tp __x)
b04fa738 1245 { return __builtin_asinh(__x); }
3115f94f 1246#endif
53dc5044 1247
3115f94f 1248#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1249 constexpr float
53dc5044
PC
1250 atanh(float __x)
1251 { return __builtin_atanhf(__x); }
1252
fa459900 1253 constexpr long double
53dc5044
PC
1254 atanh(long double __x)
1255 { return __builtin_atanhl(__x); }
ef3a7506 1256#endif
53dc5044 1257
3115f94f 1258#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1259 template<typename _Tp>
fa459900
PC
1260 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1261 double>::__type
53dc5044 1262 atanh(_Tp __x)
b04fa738 1263 { return __builtin_atanh(__x); }
3115f94f 1264#endif
53dc5044 1265
3115f94f 1266#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1267 constexpr float
53dc5044
PC
1268 cbrt(float __x)
1269 { return __builtin_cbrtf(__x); }
1270
fa459900 1271 constexpr long double
53dc5044
PC
1272 cbrt(long double __x)
1273 { return __builtin_cbrtl(__x); }
ef3a7506 1274#endif
53dc5044 1275
3115f94f 1276#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1277 template<typename _Tp>
fa459900
PC
1278 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1279 double>::__type
53dc5044 1280 cbrt(_Tp __x)
b04fa738 1281 { return __builtin_cbrt(__x); }
3115f94f 1282#endif
53dc5044 1283
3115f94f 1284#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1285 constexpr float
53dc5044
PC
1286 copysign(float __x, float __y)
1287 { return __builtin_copysignf(__x, __y); }
1288
fa459900 1289 constexpr long double
53dc5044
PC
1290 copysign(long double __x, long double __y)
1291 { return __builtin_copysignl(__x, __y); }
ef3a7506 1292#endif
53dc5044 1293
3115f94f 1294#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1295 template<typename _Tp, typename _Up>
9fb29828 1296 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1297 copysign(_Tp __x, _Up __y)
1298 {
1299 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1300 return copysign(__type(__x), __type(__y));
1301 }
3115f94f 1302#endif
53dc5044 1303
3115f94f 1304#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1305 constexpr float
53dc5044
PC
1306 erf(float __x)
1307 { return __builtin_erff(__x); }
1308
fa459900 1309 constexpr long double
53dc5044
PC
1310 erf(long double __x)
1311 { return __builtin_erfl(__x); }
ef3a7506 1312#endif
53dc5044 1313
3115f94f 1314#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1315 template<typename _Tp>
fa459900
PC
1316 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1317 double>::__type
53dc5044 1318 erf(_Tp __x)
b04fa738 1319 { return __builtin_erf(__x); }
3115f94f 1320#endif
53dc5044 1321
3115f94f 1322#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1323 constexpr float
53dc5044
PC
1324 erfc(float __x)
1325 { return __builtin_erfcf(__x); }
1326
fa459900 1327 constexpr long double
53dc5044
PC
1328 erfc(long double __x)
1329 { return __builtin_erfcl(__x); }
ef3a7506 1330#endif
53dc5044 1331
3115f94f 1332#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1333 template<typename _Tp>
fa459900
PC
1334 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1335 double>::__type
53dc5044 1336 erfc(_Tp __x)
b04fa738 1337 { return __builtin_erfc(__x); }
3115f94f 1338#endif
53dc5044 1339
3115f94f 1340#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1341 constexpr float
53dc5044
PC
1342 exp2(float __x)
1343 { return __builtin_exp2f(__x); }
1344
fa459900 1345 constexpr long double
53dc5044
PC
1346 exp2(long double __x)
1347 { return __builtin_exp2l(__x); }
ef3a7506 1348#endif
53dc5044 1349
3115f94f 1350#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1351 template<typename _Tp>
fa459900
PC
1352 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1353 double>::__type
53dc5044 1354 exp2(_Tp __x)
b04fa738 1355 { return __builtin_exp2(__x); }
3115f94f 1356#endif
53dc5044 1357
3115f94f 1358#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1359 constexpr float
53dc5044
PC
1360 expm1(float __x)
1361 { return __builtin_expm1f(__x); }
1362
fa459900 1363 constexpr long double
53dc5044
PC
1364 expm1(long double __x)
1365 { return __builtin_expm1l(__x); }
ef3a7506 1366#endif
53dc5044 1367
3115f94f 1368#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1369 template<typename _Tp>
fa459900
PC
1370 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1371 double>::__type
53dc5044 1372 expm1(_Tp __x)
b04fa738 1373 { return __builtin_expm1(__x); }
3115f94f 1374#endif
53dc5044 1375
3115f94f 1376#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1377 constexpr float
53dc5044
PC
1378 fdim(float __x, float __y)
1379 { return __builtin_fdimf(__x, __y); }
1380
fa459900 1381 constexpr long double
53dc5044
PC
1382 fdim(long double __x, long double __y)
1383 { return __builtin_fdiml(__x, __y); }
ef3a7506 1384#endif
53dc5044 1385
3115f94f 1386#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1387 template<typename _Tp, typename _Up>
9fb29828 1388 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1389 fdim(_Tp __x, _Up __y)
1390 {
1391 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1392 return fdim(__type(__x), __type(__y));
1393 }
3115f94f 1394#endif
53dc5044 1395
3115f94f 1396#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1397 constexpr float
53dc5044
PC
1398 fma(float __x, float __y, float __z)
1399 { return __builtin_fmaf(__x, __y, __z); }
1400
fa459900 1401 constexpr long double
53dc5044
PC
1402 fma(long double __x, long double __y, long double __z)
1403 { return __builtin_fmal(__x, __y, __z); }
ef3a7506 1404#endif
53dc5044 1405
3115f94f 1406#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1407 template<typename _Tp, typename _Up, typename _Vp>
9fb29828 1408 constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
53dc5044
PC
1409 fma(_Tp __x, _Up __y, _Vp __z)
1410 {
1411 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
1412 return fma(__type(__x), __type(__y), __type(__z));
1413 }
3115f94f 1414#endif
53dc5044 1415
3115f94f 1416#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1417 constexpr float
53dc5044
PC
1418 fmax(float __x, float __y)
1419 { return __builtin_fmaxf(__x, __y); }
1420
fa459900 1421 constexpr long double
53dc5044
PC
1422 fmax(long double __x, long double __y)
1423 { return __builtin_fmaxl(__x, __y); }
ef3a7506 1424#endif
53dc5044 1425
3115f94f 1426#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1427 template<typename _Tp, typename _Up>
9fb29828 1428 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1429 fmax(_Tp __x, _Up __y)
1430 {
1431 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1432 return fmax(__type(__x), __type(__y));
1433 }
3115f94f 1434#endif
53dc5044 1435
3115f94f 1436#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1437 constexpr float
53dc5044
PC
1438 fmin(float __x, float __y)
1439 { return __builtin_fminf(__x, __y); }
1440
fa459900 1441 constexpr long double
53dc5044
PC
1442 fmin(long double __x, long double __y)
1443 { return __builtin_fminl(__x, __y); }
ef3a7506 1444#endif
53dc5044 1445
3115f94f 1446#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1447 template<typename _Tp, typename _Up>
9fb29828 1448 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1449 fmin(_Tp __x, _Up __y)
1450 {
1451 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1452 return fmin(__type(__x), __type(__y));
1453 }
3115f94f 1454#endif
53dc5044 1455
3115f94f 1456#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1457 constexpr float
53dc5044
PC
1458 hypot(float __x, float __y)
1459 { return __builtin_hypotf(__x, __y); }
1460
fa459900 1461 constexpr long double
53dc5044
PC
1462 hypot(long double __x, long double __y)
1463 { return __builtin_hypotl(__x, __y); }
ef3a7506 1464#endif
53dc5044 1465
3115f94f 1466#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1467 template<typename _Tp, typename _Up>
9fb29828
PC
1468 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1469 hypot(_Tp __x, _Up __y)
53dc5044
PC
1470 {
1471 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1472 return hypot(__type(__x), __type(__y));
1473 }
3115f94f 1474#endif
53dc5044 1475
3115f94f 1476#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1477 constexpr int
53dc5044
PC
1478 ilogb(float __x)
1479 { return __builtin_ilogbf(__x); }
1480
fa459900 1481 constexpr int
53dc5044
PC
1482 ilogb(long double __x)
1483 { return __builtin_ilogbl(__x); }
ef3a7506 1484#endif
53dc5044 1485
3115f94f 1486#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1487 template<typename _Tp>
fa459900
PC
1488 constexpr
1489 typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1490 int>::__type
53dc5044 1491 ilogb(_Tp __x)
b04fa738 1492 { return __builtin_ilogb(__x); }
3115f94f 1493#endif
53dc5044 1494
3115f94f 1495#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1496 constexpr float
53dc5044
PC
1497 lgamma(float __x)
1498 { return __builtin_lgammaf(__x); }
1499
fa459900 1500 constexpr long double
53dc5044
PC
1501 lgamma(long double __x)
1502 { return __builtin_lgammal(__x); }
ef3a7506 1503#endif
53dc5044 1504
3115f94f 1505#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1506 template<typename _Tp>
fa459900
PC
1507 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1508 double>::__type
53dc5044 1509 lgamma(_Tp __x)
b04fa738 1510 { return __builtin_lgamma(__x); }
3115f94f 1511#endif
53dc5044 1512
3115f94f 1513#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1514 constexpr long long
53dc5044
PC
1515 llrint(float __x)
1516 { return __builtin_llrintf(__x); }
1517
fa459900 1518 constexpr long long
53dc5044
PC
1519 llrint(long double __x)
1520 { return __builtin_llrintl(__x); }
ef3a7506 1521#endif
53dc5044 1522
3115f94f 1523#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1524 template<typename _Tp>
fa459900
PC
1525 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1526 long long>::__type
53dc5044 1527 llrint(_Tp __x)
b04fa738 1528 { return __builtin_llrint(__x); }
3115f94f 1529#endif
53dc5044 1530
3115f94f 1531#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1532 constexpr long long
53dc5044
PC
1533 llround(float __x)
1534 { return __builtin_llroundf(__x); }
1535
fa459900 1536 constexpr long long
53dc5044
PC
1537 llround(long double __x)
1538 { return __builtin_llroundl(__x); }
ef3a7506 1539#endif
53dc5044 1540
3115f94f 1541#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1542 template<typename _Tp>
fa459900
PC
1543 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1544 long long>::__type
53dc5044 1545 llround(_Tp __x)
b04fa738 1546 { return __builtin_llround(__x); }
3115f94f 1547#endif
53dc5044 1548
3115f94f 1549#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1550 constexpr float
53dc5044
PC
1551 log1p(float __x)
1552 { return __builtin_log1pf(__x); }
1553
fa459900 1554 constexpr long double
53dc5044
PC
1555 log1p(long double __x)
1556 { return __builtin_log1pl(__x); }
ef3a7506 1557#endif
53dc5044 1558
3115f94f 1559#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1560 template<typename _Tp>
fa459900
PC
1561 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1562 double>::__type
53dc5044 1563 log1p(_Tp __x)
b04fa738 1564 { return __builtin_log1p(__x); }
3115f94f 1565#endif
53dc5044 1566
3115f94f 1567#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
53dc5044 1568 // DR 568.
fa459900 1569 constexpr float
53dc5044
PC
1570 log2(float __x)
1571 { return __builtin_log2f(__x); }
1572
fa459900 1573 constexpr long double
53dc5044
PC
1574 log2(long double __x)
1575 { return __builtin_log2l(__x); }
ef3a7506 1576#endif
53dc5044 1577
3115f94f 1578#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1579 template<typename _Tp>
fa459900
PC
1580 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1581 double>::__type
53dc5044 1582 log2(_Tp __x)
b04fa738 1583 { return __builtin_log2(__x); }
3115f94f 1584#endif
53dc5044 1585
3115f94f 1586#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1587 constexpr float
53dc5044
PC
1588 logb(float __x)
1589 { return __builtin_logbf(__x); }
1590
fa459900 1591 constexpr long double
53dc5044
PC
1592 logb(long double __x)
1593 { return __builtin_logbl(__x); }
ef3a7506 1594#endif
53dc5044 1595
3115f94f 1596#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1597 template<typename _Tp>
fa459900
PC
1598 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1599 double>::__type
53dc5044 1600 logb(_Tp __x)
b04fa738 1601 { return __builtin_logb(__x); }
3115f94f 1602#endif
53dc5044 1603
3115f94f 1604#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1605 constexpr long
53dc5044
PC
1606 lrint(float __x)
1607 { return __builtin_lrintf(__x); }
1608
fa459900 1609 constexpr long
53dc5044
PC
1610 lrint(long double __x)
1611 { return __builtin_lrintl(__x); }
ef3a7506 1612#endif
53dc5044 1613
3115f94f 1614#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1615 template<typename _Tp>
fa459900
PC
1616 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1617 long>::__type
53dc5044 1618 lrint(_Tp __x)
b04fa738 1619 { return __builtin_lrint(__x); }
3115f94f 1620#endif
53dc5044 1621
3115f94f 1622#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1623 constexpr long
53dc5044
PC
1624 lround(float __x)
1625 { return __builtin_lroundf(__x); }
1626
fa459900 1627 constexpr long
53dc5044
PC
1628 lround(long double __x)
1629 { return __builtin_lroundl(__x); }
ef3a7506 1630#endif
53dc5044 1631
3115f94f 1632#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1633 template<typename _Tp>
fa459900
PC
1634 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1635 long>::__type
53dc5044 1636 lround(_Tp __x)
b04fa738 1637 { return __builtin_lround(__x); }
3115f94f 1638#endif
53dc5044 1639
3115f94f 1640#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1641 constexpr float
53dc5044
PC
1642 nearbyint(float __x)
1643 { return __builtin_nearbyintf(__x); }
1644
fa459900 1645 constexpr long double
53dc5044
PC
1646 nearbyint(long double __x)
1647 { return __builtin_nearbyintl(__x); }
ef3a7506 1648#endif
53dc5044 1649
3115f94f 1650#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1651 template<typename _Tp>
fa459900
PC
1652 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1653 double>::__type
53dc5044 1654 nearbyint(_Tp __x)
b04fa738 1655 { return __builtin_nearbyint(__x); }
3115f94f 1656#endif
53dc5044 1657
3115f94f 1658#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1659 constexpr float
53dc5044
PC
1660 nextafter(float __x, float __y)
1661 { return __builtin_nextafterf(__x, __y); }
1662
fa459900 1663 constexpr long double
53dc5044
PC
1664 nextafter(long double __x, long double __y)
1665 { return __builtin_nextafterl(__x, __y); }
ef3a7506 1666#endif
53dc5044 1667
3115f94f 1668#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1669 template<typename _Tp, typename _Up>
9fb29828 1670 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1671 nextafter(_Tp __x, _Up __y)
1672 {
1673 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1674 return nextafter(__type(__x), __type(__y));
1675 }
3115f94f 1676#endif
53dc5044 1677
3115f94f 1678#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1679 constexpr float
53dc5044
PC
1680 nexttoward(float __x, long double __y)
1681 { return __builtin_nexttowardf(__x, __y); }
1682
fa459900 1683 constexpr long double
53dc5044
PC
1684 nexttoward(long double __x, long double __y)
1685 { return __builtin_nexttowardl(__x, __y); }
ef3a7506 1686#endif
53dc5044 1687
3115f94f 1688#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1689 template<typename _Tp>
fa459900
PC
1690 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1691 double>::__type
53dc5044 1692 nexttoward(_Tp __x, long double __y)
b04fa738 1693 { return __builtin_nexttoward(__x, __y); }
3115f94f 1694#endif
53dc5044 1695
3115f94f 1696#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1697 constexpr float
53dc5044
PC
1698 remainder(float __x, float __y)
1699 { return __builtin_remainderf(__x, __y); }
1700
fa459900 1701 constexpr long double
53dc5044
PC
1702 remainder(long double __x, long double __y)
1703 { return __builtin_remainderl(__x, __y); }
ef3a7506 1704#endif
53dc5044 1705
3115f94f 1706#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1707 template<typename _Tp, typename _Up>
9fb29828 1708 constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1709 remainder(_Tp __x, _Up __y)
1710 {
1711 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1712 return remainder(__type(__x), __type(__y));
1713 }
3115f94f 1714#endif
53dc5044 1715
3115f94f 1716#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
77addcb7 1717 inline float
53dc5044
PC
1718 remquo(float __x, float __y, int* __pquo)
1719 { return __builtin_remquof(__x, __y, __pquo); }
1720
77addcb7 1721 inline long double
53dc5044
PC
1722 remquo(long double __x, long double __y, int* __pquo)
1723 { return __builtin_remquol(__x, __y, __pquo); }
ef3a7506 1724#endif
53dc5044 1725
3115f94f 1726#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1727 template<typename _Tp, typename _Up>
77addcb7 1728 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
53dc5044
PC
1729 remquo(_Tp __x, _Up __y, int* __pquo)
1730 {
1731 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1732 return remquo(__type(__x), __type(__y), __pquo);
1733 }
3115f94f 1734#endif
53dc5044 1735
3115f94f 1736#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1737 constexpr float
53dc5044
PC
1738 rint(float __x)
1739 { return __builtin_rintf(__x); }
1740
fa459900 1741 constexpr long double
53dc5044
PC
1742 rint(long double __x)
1743 { return __builtin_rintl(__x); }
ef3a7506 1744#endif
53dc5044 1745
3115f94f 1746#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1747 template<typename _Tp>
fa459900
PC
1748 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1749 double>::__type
53dc5044 1750 rint(_Tp __x)
b04fa738 1751 { return __builtin_rint(__x); }
3115f94f 1752#endif
53dc5044 1753
3115f94f 1754#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1755 constexpr float
53dc5044
PC
1756 round(float __x)
1757 { return __builtin_roundf(__x); }
1758
fa459900 1759 constexpr long double
53dc5044
PC
1760 round(long double __x)
1761 { return __builtin_roundl(__x); }
ef3a7506 1762#endif
53dc5044 1763
3115f94f 1764#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1765 template<typename _Tp>
fa459900
PC
1766 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1767 double>::__type
53dc5044 1768 round(_Tp __x)
b04fa738 1769 { return __builtin_round(__x); }
3115f94f 1770#endif
53dc5044 1771
3115f94f 1772#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1773 constexpr float
53dc5044
PC
1774 scalbln(float __x, long __ex)
1775 { return __builtin_scalblnf(__x, __ex); }
1776
fa459900 1777 constexpr long double
53dc5044
PC
1778 scalbln(long double __x, long __ex)
1779 { return __builtin_scalblnl(__x, __ex); }
ef3a7506 1780#endif
53dc5044 1781
3115f94f 1782#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1783 template<typename _Tp>
fa459900
PC
1784 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1785 double>::__type
53dc5044 1786 scalbln(_Tp __x, long __ex)
b04fa738 1787 { return __builtin_scalbln(__x, __ex); }
3115f94f 1788#endif
53dc5044 1789
3115f94f 1790#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1791 constexpr float
53dc5044
PC
1792 scalbn(float __x, int __ex)
1793 { return __builtin_scalbnf(__x, __ex); }
1794
fa459900 1795 constexpr long double
53dc5044
PC
1796 scalbn(long double __x, int __ex)
1797 { return __builtin_scalbnl(__x, __ex); }
ef3a7506 1798#endif
53dc5044 1799
3115f94f 1800#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1801 template<typename _Tp>
fa459900
PC
1802 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1803 double>::__type
53dc5044 1804 scalbn(_Tp __x, int __ex)
b04fa738 1805 { return __builtin_scalbn(__x, __ex); }
3115f94f 1806#endif
53dc5044 1807
3115f94f 1808#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1809 constexpr float
53dc5044
PC
1810 tgamma(float __x)
1811 { return __builtin_tgammaf(__x); }
1812
fa459900 1813 constexpr long double
53dc5044
PC
1814 tgamma(long double __x)
1815 { return __builtin_tgammal(__x); }
ef3a7506 1816#endif
53dc5044 1817
3115f94f 1818#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1819 template<typename _Tp>
fa459900
PC
1820 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1821 double>::__type
53dc5044 1822 tgamma(_Tp __x)
b04fa738 1823 { return __builtin_tgamma(__x); }
3115f94f 1824#endif
53dc5044 1825
3115f94f 1826#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
fa459900 1827 constexpr float
53dc5044
PC
1828 trunc(float __x)
1829 { return __builtin_truncf(__x); }
1830
fa459900 1831 constexpr long double
53dc5044
PC
1832 trunc(long double __x)
1833 { return __builtin_truncl(__x); }
ef3a7506 1834#endif
53dc5044 1835
3115f94f 1836#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
53dc5044 1837 template<typename _Tp>
fa459900
PC
1838 constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1839 double>::__type
53dc5044 1840 trunc(_Tp __x)
b04fa738 1841 { return __builtin_trunc(__x); }
3115f94f 1842#endif
53dc5044 1843
53dc5044 1844#endif // _GLIBCXX_USE_C99_MATH_TR1
734f5023 1845#endif // C++11
53dc5044 1846
998e01a6 1847#if __cplusplus > 201402L
998e01a6
JW
1848
1849 // [c.math.hypot3], three-dimensional hypotenuse
1850#define __cpp_lib_hypot 201603
1851
1852 template<typename _Tp>
1853 inline _Tp
1854 __hypot3(_Tp __x, _Tp __y, _Tp __z)
1855 {
1856 __x = std::abs(__x);
1857 __y = std::abs(__y);
1858 __z = std::abs(__z);
1859 if (_Tp __a = __x < __y ? __y < __z ? __z : __y : __x < __z ? __z : __x)
1860 return __a * std::sqrt((__x / __a) * (__x / __a)
1861 + (__y / __a) * (__y / __a)
1862 + (__z / __a) * (__z / __a));
1863 else
1864 return {};
1865 }
1866
1867 inline float
1868 hypot(float __x, float __y, float __z)
1869 { return std::__hypot3<float>(__x, __y, __z); }
1870
1871 inline double
1872 hypot(double __x, double __y, double __z)
1873 { return std::__hypot3<double>(__x, __y, __z); }
1874
1875 inline long double
1876 hypot(long double __x, long double __y, long double __z)
1877 { return std::__hypot3<long double>(__x, __y, __z); }
1878
1879 template<typename _Tp, typename _Up, typename _Vp>
1880 typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
1881 hypot(_Tp __x, _Up __y, _Vp __z)
1882 {
1883 using __type = typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type;
1884 return std::__hypot3<__type>(__x, __y, __z);
1885 }
998e01a6
JW
1886#endif // C++17
1887
4a15d842
FD
1888_GLIBCXX_END_NAMESPACE_VERSION
1889} // namespace
998e01a6 1890
f8571e51 1891#if _GLIBCXX_USE_STD_SPEC_FUNCS
2be75957
ESR
1892# include <bits/specfun.h>
1893#endif
1894
eac437bf
JW
1895} // extern "C++"
1896
af13a7a6 1897#endif