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