libstdc++
cmath
Go to the documentation of this file.
1 // -*- C++ -*- C forwarding header.
2 
3 // Copyright (C) 1997-2023 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/requires_hosted.h>
42 
43 #include <bits/c++config.h>
44 #include <bits/cpp_type_traits.h>
45 #include <ext/type_traits.h>
46 #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
47 #include_next <math.h>
48 #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS
49 #include <bits/std_abs.h>
50 
51 #ifndef _GLIBCXX_CMATH
52 #define _GLIBCXX_CMATH 1
53 
54 // Get rid of those macros defined in <math.h> in lieu of real functions.
55 #undef div
56 #undef acos
57 #undef asin
58 #undef atan
59 #undef atan2
60 #undef ceil
61 #undef cos
62 #undef cosh
63 #undef exp
64 #undef fabs
65 #undef floor
66 #undef fmod
67 #undef frexp
68 #undef ldexp
69 #undef log
70 #undef log10
71 #undef modf
72 #undef pow
73 #undef sin
74 #undef sinh
75 #undef sqrt
76 #undef tan
77 #undef tanh
78 
79 extern "C++"
80 {
81 namespace std _GLIBCXX_VISIBILITY(default)
82 {
83 _GLIBCXX_BEGIN_NAMESPACE_VERSION
84 
85  using ::acos;
86 
87 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
88  inline _GLIBCXX_CONSTEXPR float
89  acos(float __x)
90  { return __builtin_acosf(__x); }
91 
92  inline _GLIBCXX_CONSTEXPR long double
93  acos(long double __x)
94  { return __builtin_acosl(__x); }
95 #endif
96 
97  template<typename _Tp>
98  inline _GLIBCXX_CONSTEXPR
99  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
100  double>::__type
101  acos(_Tp __x)
102  { return __builtin_acos(__x); }
103 
104  using ::asin;
105 
106 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
107  inline _GLIBCXX_CONSTEXPR float
108  asin(float __x)
109  { return __builtin_asinf(__x); }
110 
111  inline _GLIBCXX_CONSTEXPR long double
112  asin(long double __x)
113  { return __builtin_asinl(__x); }
114 #endif
115 
116  template<typename _Tp>
117  inline _GLIBCXX_CONSTEXPR
118  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
119  double>::__type
120  asin(_Tp __x)
121  { return __builtin_asin(__x); }
122 
123  using ::atan;
124 
125 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
126  inline _GLIBCXX_CONSTEXPR float
127  atan(float __x)
128  { return __builtin_atanf(__x); }
129 
130  inline _GLIBCXX_CONSTEXPR long double
131  atan(long double __x)
132  { return __builtin_atanl(__x); }
133 #endif
134 
135  template<typename _Tp>
136  inline _GLIBCXX_CONSTEXPR
137  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
138  double>::__type
139  atan(_Tp __x)
140  { return __builtin_atan(__x); }
141 
142  using ::atan2;
143 
144 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
145  inline _GLIBCXX_CONSTEXPR float
146  atan2(float __y, float __x)
147  { return __builtin_atan2f(__y, __x); }
148 
149  inline _GLIBCXX_CONSTEXPR long double
150  atan2(long double __y, long double __x)
151  { return __builtin_atan2l(__y, __x); }
152 #endif
153 
154  using ::ceil;
155 
156 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
157  inline _GLIBCXX_CONSTEXPR float
158  ceil(float __x)
159  { return __builtin_ceilf(__x); }
160 
161  inline _GLIBCXX_CONSTEXPR long double
162  ceil(long double __x)
163  { return __builtin_ceill(__x); }
164 #endif
165 
166  template<typename _Tp>
167  inline _GLIBCXX_CONSTEXPR
168  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
169  double>::__type
170  ceil(_Tp __x)
171  { return __builtin_ceil(__x); }
172 
173  using ::cos;
174 
175 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
176  inline _GLIBCXX_CONSTEXPR float
177  cos(float __x)
178  { return __builtin_cosf(__x); }
179 
180  inline _GLIBCXX_CONSTEXPR long double
181  cos(long double __x)
182  { return __builtin_cosl(__x); }
183 #endif
184 
185  template<typename _Tp>
186  inline _GLIBCXX_CONSTEXPR
187  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
188  double>::__type
189  cos(_Tp __x)
190  { return __builtin_cos(__x); }
191 
192  using ::cosh;
193 
194 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
195  inline _GLIBCXX_CONSTEXPR float
196  cosh(float __x)
197  { return __builtin_coshf(__x); }
198 
199  inline _GLIBCXX_CONSTEXPR long double
200  cosh(long double __x)
201  { return __builtin_coshl(__x); }
202 #endif
203 
204  template<typename _Tp>
205  inline _GLIBCXX_CONSTEXPR
206  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
207  double>::__type
208  cosh(_Tp __x)
209  { return __builtin_cosh(__x); }
210 
211  using ::exp;
212 
213 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
214  inline _GLIBCXX_CONSTEXPR float
215  exp(float __x)
216  { return __builtin_expf(__x); }
217 
218  inline _GLIBCXX_CONSTEXPR long double
219  exp(long double __x)
220  { return __builtin_expl(__x); }
221 #endif
222 
223  template<typename _Tp>
224  inline _GLIBCXX_CONSTEXPR
225  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
226  double>::__type
227  exp(_Tp __x)
228  { return __builtin_exp(__x); }
229 
230  using ::fabs;
231 
232 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
233  inline _GLIBCXX_CONSTEXPR float
234  fabs(float __x)
235  { return __builtin_fabsf(__x); }
236 
237  inline _GLIBCXX_CONSTEXPR long double
238  fabs(long double __x)
239  { return __builtin_fabsl(__x); }
240 #endif
241 
242  template<typename _Tp>
243  inline _GLIBCXX_CONSTEXPR
244  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
245  double>::__type
246  fabs(_Tp __x)
247  { return __builtin_fabs(__x); }
248 
249  using ::floor;
250 
251 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
252  inline _GLIBCXX_CONSTEXPR float
253  floor(float __x)
254  { return __builtin_floorf(__x); }
255 
256  inline _GLIBCXX_CONSTEXPR long double
257  floor(long double __x)
258  { return __builtin_floorl(__x); }
259 #endif
260 
261  template<typename _Tp>
262  inline _GLIBCXX_CONSTEXPR
263  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
264  double>::__type
265  floor(_Tp __x)
266  { return __builtin_floor(__x); }
267 
268  using ::fmod;
269 
270 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
271  inline _GLIBCXX_CONSTEXPR float
272  fmod(float __x, float __y)
273  { return __builtin_fmodf(__x, __y); }
274 
275  inline _GLIBCXX_CONSTEXPR long double
276  fmod(long double __x, long double __y)
277  { return __builtin_fmodl(__x, __y); }
278 #endif
279 
280  using ::frexp;
281 
282 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
283  inline float
284  frexp(float __x, int* __exp)
285  { return __builtin_frexpf(__x, __exp); }
286 
287  inline long double
288  frexp(long double __x, int* __exp)
289  { return __builtin_frexpl(__x, __exp); }
290 #endif
291 
292  template<typename _Tp>
293  inline _GLIBCXX_CONSTEXPR
294  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
295  double>::__type
296  frexp(_Tp __x, int* __exp)
297  { return __builtin_frexp(__x, __exp); }
298 
299  using ::ldexp;
300 
301 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
302  inline _GLIBCXX_CONSTEXPR float
303  ldexp(float __x, int __exp)
304  { return __builtin_ldexpf(__x, __exp); }
305 
306  inline _GLIBCXX_CONSTEXPR long double
307  ldexp(long double __x, int __exp)
308  { return __builtin_ldexpl(__x, __exp); }
309 #endif
310 
311  template<typename _Tp>
312  inline _GLIBCXX_CONSTEXPR
313  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
314  double>::__type
315  ldexp(_Tp __x, int __exp)
316  { return __builtin_ldexp(__x, __exp); }
317 
318  using ::log;
319 
320 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
321  inline _GLIBCXX_CONSTEXPR float
322  log(float __x)
323  { return __builtin_logf(__x); }
324 
325  inline _GLIBCXX_CONSTEXPR long double
326  log(long double __x)
327  { return __builtin_logl(__x); }
328 #endif
329 
330  template<typename _Tp>
331  inline _GLIBCXX_CONSTEXPR
332  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
333  double>::__type
334  log(_Tp __x)
335  { return __builtin_log(__x); }
336 
337  using ::log10;
338 
339 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
340  inline _GLIBCXX_CONSTEXPR float
341  log10(float __x)
342  { return __builtin_log10f(__x); }
343 
344  inline _GLIBCXX_CONSTEXPR long double
345  log10(long double __x)
346  { return __builtin_log10l(__x); }
347 #endif
348 
349  template<typename _Tp>
350  inline _GLIBCXX_CONSTEXPR
351  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
352  double>::__type
353  log10(_Tp __x)
354  { return __builtin_log10(__x); }
355 
356  using ::modf;
357 
358 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
359  inline float
360  modf(float __x, float* __iptr)
361  { return __builtin_modff(__x, __iptr); }
362 
363  inline long double
364  modf(long double __x, long double* __iptr)
365  { return __builtin_modfl(__x, __iptr); }
366 #endif
367 
368  using ::pow;
369 
370 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
371  inline _GLIBCXX_CONSTEXPR float
372  pow(float __x, float __y)
373  { return __builtin_powf(__x, __y); }
374 
375  inline _GLIBCXX_CONSTEXPR long double
376  pow(long double __x, long double __y)
377  { return __builtin_powl(__x, __y); }
378 
379 #if __cplusplus < 201103L
380  // _GLIBCXX_RESOLVE_LIB_DEFECTS
381  // DR 550. What should the return type of pow(float,int) be?
382  inline double
383  pow(double __x, int __i)
384  { return __builtin_powi(__x, __i); }
385 
386  inline float
387  pow(float __x, int __n)
388  { return __builtin_powif(__x, __n); }
389 
390  inline long double
391  pow(long double __x, int __n)
392  { return __builtin_powil(__x, __n); }
393 #endif
394 #endif
395 
396  using ::sin;
397 
398 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
399  inline _GLIBCXX_CONSTEXPR float
400  sin(float __x)
401  { return __builtin_sinf(__x); }
402 
403  inline _GLIBCXX_CONSTEXPR long double
404  sin(long double __x)
405  { return __builtin_sinl(__x); }
406 #endif
407 
408  template<typename _Tp>
409  inline _GLIBCXX_CONSTEXPR
410  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
411  double>::__type
412  sin(_Tp __x)
413  { return __builtin_sin(__x); }
414 
415  using ::sinh;
416 
417 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
418  inline _GLIBCXX_CONSTEXPR float
419  sinh(float __x)
420  { return __builtin_sinhf(__x); }
421 
422  inline _GLIBCXX_CONSTEXPR long double
423  sinh(long double __x)
424  { return __builtin_sinhl(__x); }
425 #endif
426 
427  template<typename _Tp>
428  inline _GLIBCXX_CONSTEXPR
429  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
430  double>::__type
431  sinh(_Tp __x)
432  { return __builtin_sinh(__x); }
433 
434  using ::sqrt;
435 
436 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
437  inline _GLIBCXX_CONSTEXPR float
438  sqrt(float __x)
439  { return __builtin_sqrtf(__x); }
440 
441  inline _GLIBCXX_CONSTEXPR long double
442  sqrt(long double __x)
443  { return __builtin_sqrtl(__x); }
444 #endif
445 
446  template<typename _Tp>
447  inline _GLIBCXX_CONSTEXPR
448  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
449  double>::__type
450  sqrt(_Tp __x)
451  { return __builtin_sqrt(__x); }
452 
453  using ::tan;
454 
455 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
456  inline _GLIBCXX_CONSTEXPR float
457  tan(float __x)
458  { return __builtin_tanf(__x); }
459 
460  inline _GLIBCXX_CONSTEXPR long double
461  tan(long double __x)
462  { return __builtin_tanl(__x); }
463 #endif
464 
465  template<typename _Tp>
466  inline _GLIBCXX_CONSTEXPR
467  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
468  double>::__type
469  tan(_Tp __x)
470  { return __builtin_tan(__x); }
471 
472  using ::tanh;
473 
474 #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO
475  inline _GLIBCXX_CONSTEXPR float
476  tanh(float __x)
477  { return __builtin_tanhf(__x); }
478 
479  inline _GLIBCXX_CONSTEXPR long double
480  tanh(long double __x)
481  { return __builtin_tanhl(__x); }
482 #endif
483 
484  template<typename _Tp>
485  inline _GLIBCXX_CONSTEXPR
486  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
487  double>::__type
488  tanh(_Tp __x)
489  { return __builtin_tanh(__x); }
490 
491 #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
492  constexpr _Float16
493  acos(_Float16 __x)
494  { return _Float16(__builtin_acosf(__x)); }
495 
496  constexpr _Float16
497  asin(_Float16 __x)
498  { return _Float16(__builtin_asinf(__x)); }
499 
500  constexpr _Float16
501  atan(_Float16 __x)
502  { return _Float16(__builtin_atanf(__x)); }
503 
504  constexpr _Float16
505  atan2(_Float16 __y, _Float16 __x)
506  { return _Float16(__builtin_atan2f(__y, __x)); }
507 
508  constexpr _Float16
509  ceil(_Float16 __x)
510  { return _Float16(__builtin_ceilf(__x)); }
511 
512  constexpr _Float16
513  cos(_Float16 __x)
514  { return _Float16(__builtin_cosf(__x)); }
515 
516  constexpr _Float16
517  cosh(_Float16 __x)
518  { return _Float16(__builtin_coshf(__x)); }
519 
520  constexpr _Float16
521  exp(_Float16 __x)
522  { return _Float16(__builtin_expf(__x)); }
523 
524  constexpr _Float16
525  fabs(_Float16 __x)
526  { return _Float16(__builtin_fabsf(__x)); }
527 
528  constexpr _Float16
529  floor(_Float16 __x)
530  { return _Float16(__builtin_floorf(__x)); }
531 
532  constexpr _Float16
533  fmod(_Float16 __x, _Float16 __y)
534  { return _Float16(__builtin_fmodf(__x, __y)); }
535 
536  inline _Float16
537  frexp(_Float16 __x, int* __exp)
538  { return _Float16(__builtin_frexpf(__x, __exp)); }
539 
540  constexpr _Float16
541  ldexp(_Float16 __x, int __exp)
542  { return _Float16(__builtin_ldexpf(__x, __exp)); }
543 
544  constexpr _Float16
545  log(_Float16 __x)
546  { return _Float16(__builtin_logf(__x)); }
547 
548  constexpr _Float16
549  log10(_Float16 __x)
550  { return _Float16(__builtin_log10f(__x)); }
551 
552  inline _Float16
553  modf(_Float16 __x, _Float16* __iptr)
554  {
555  float __i, __ret = __builtin_modff(__x, &__i);
556  *__iptr = _Float16(__i);
557  return _Float16(__ret);
558  }
559 
560  constexpr _Float16
561  pow(_Float16 __x, _Float16 __y)
562  { return _Float16(__builtin_powf(__x, __y)); }
563 
564  constexpr _Float16
565  sin(_Float16 __x)
566  { return _Float16(__builtin_sinf(__x)); }
567 
568  constexpr _Float16
569  sinh(_Float16 __x)
570  { return _Float16(__builtin_sinhf(__x)); }
571 
572  constexpr _Float16
573  sqrt(_Float16 __x)
574  { return _Float16(__builtin_sqrtf(__x)); }
575 
576  constexpr _Float16
577  tan(_Float16 __x)
578  { return _Float16(__builtin_tanf(__x)); }
579 
580  constexpr _Float16
581  tanh(_Float16 __x)
582  { return _Float16(__builtin_tanhf(__x)); }
583 #endif
584 
585 #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
586  constexpr _Float32
587  acos(_Float32 __x)
588  { return __builtin_acosf(__x); }
589 
590  constexpr _Float32
591  asin(_Float32 __x)
592  { return __builtin_asinf(__x); }
593 
594  constexpr _Float32
595  atan(_Float32 __x)
596  { return __builtin_atanf(__x); }
597 
598  constexpr _Float32
599  atan2(_Float32 __y, _Float32 __x)
600  { return __builtin_atan2f(__y, __x); }
601 
602  constexpr _Float32
603  ceil(_Float32 __x)
604  { return __builtin_ceilf(__x); }
605 
606  constexpr _Float32
607  cos(_Float32 __x)
608  { return __builtin_cosf(__x); }
609 
610  constexpr _Float32
611  cosh(_Float32 __x)
612  { return __builtin_coshf(__x); }
613 
614  constexpr _Float32
615  exp(_Float32 __x)
616  { return __builtin_expf(__x); }
617 
618  constexpr _Float32
619  fabs(_Float32 __x)
620  { return __builtin_fabsf(__x); }
621 
622  constexpr _Float32
623  floor(_Float32 __x)
624  { return __builtin_floorf(__x); }
625 
626  constexpr _Float32
627  fmod(_Float32 __x, _Float32 __y)
628  { return __builtin_fmodf(__x, __y); }
629 
630  inline _Float32
631  frexp(_Float32 __x, int* __exp)
632  { return __builtin_frexpf(__x, __exp); }
633 
634  constexpr _Float32
635  ldexp(_Float32 __x, int __exp)
636  { return __builtin_ldexpf(__x, __exp); }
637 
638  constexpr _Float32
639  log(_Float32 __x)
640  { return __builtin_logf(__x); }
641 
642  constexpr _Float32
643  log10(_Float32 __x)
644  { return __builtin_log10f(__x); }
645 
646  inline _Float32
647  modf(_Float32 __x, _Float32* __iptr)
648  {
649  float __i, __ret = __builtin_modff(__x, &__i);
650  *__iptr = __i;
651  return __ret;
652  }
653 
654  constexpr _Float32
655  pow(_Float32 __x, _Float32 __y)
656  { return __builtin_powf(__x, __y); }
657 
658  constexpr _Float32
659  sin(_Float32 __x)
660  { return __builtin_sinf(__x); }
661 
662  constexpr _Float32
663  sinh(_Float32 __x)
664  { return __builtin_sinhf(__x); }
665 
666  constexpr _Float32
667  sqrt(_Float32 __x)
668  { return __builtin_sqrtf(__x); }
669 
670  constexpr _Float32
671  tan(_Float32 __x)
672  { return __builtin_tanf(__x); }
673 
674  constexpr _Float32
675  tanh(_Float32 __x)
676  { return __builtin_tanhf(__x); }
677 #endif
678 
679 #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
680  constexpr _Float64
681  acos(_Float64 __x)
682  { return __builtin_acos(__x); }
683 
684  constexpr _Float64
685  asin(_Float64 __x)
686  { return __builtin_asin(__x); }
687 
688  constexpr _Float64
689  atan(_Float64 __x)
690  { return __builtin_atan(__x); }
691 
692  constexpr _Float64
693  atan2(_Float64 __y, _Float64 __x)
694  { return __builtin_atan2(__y, __x); }
695 
696  constexpr _Float64
697  ceil(_Float64 __x)
698  { return __builtin_ceil(__x); }
699 
700  constexpr _Float64
701  cos(_Float64 __x)
702  { return __builtin_cos(__x); }
703 
704  constexpr _Float64
705  cosh(_Float64 __x)
706  { return __builtin_cosh(__x); }
707 
708  constexpr _Float64
709  exp(_Float64 __x)
710  { return __builtin_exp(__x); }
711 
712  constexpr _Float64
713  fabs(_Float64 __x)
714  { return __builtin_fabs(__x); }
715 
716  constexpr _Float64
717  floor(_Float64 __x)
718  { return __builtin_floor(__x); }
719 
720  constexpr _Float64
721  fmod(_Float64 __x, _Float64 __y)
722  { return __builtin_fmod(__x, __y); }
723 
724  inline _Float64
725  frexp(_Float64 __x, int* __exp)
726  { return __builtin_frexp(__x, __exp); }
727 
728  constexpr _Float64
729  ldexp(_Float64 __x, int __exp)
730  { return __builtin_ldexp(__x, __exp); }
731 
732  constexpr _Float64
733  log(_Float64 __x)
734  { return __builtin_log(__x); }
735 
736  constexpr _Float64
737  log10(_Float64 __x)
738  { return __builtin_log10(__x); }
739 
740  inline _Float64
741  modf(_Float64 __x, _Float64* __iptr)
742  {
743  double __i, __ret = __builtin_modf(__x, &__i);
744  *__iptr = __i;
745  return __ret;
746  }
747 
748  constexpr _Float64
749  pow(_Float64 __x, _Float64 __y)
750  { return __builtin_pow(__x, __y); }
751 
752  constexpr _Float64
753  sin(_Float64 __x)
754  { return __builtin_sin(__x); }
755 
756  constexpr _Float64
757  sinh(_Float64 __x)
758  { return __builtin_sinh(__x); }
759 
760  constexpr _Float64
761  sqrt(_Float64 __x)
762  { return __builtin_sqrt(__x); }
763 
764  constexpr _Float64
765  tan(_Float64 __x)
766  { return __builtin_tan(__x); }
767 
768  constexpr _Float64
769  tanh(_Float64 __x)
770  { return __builtin_tanh(__x); }
771 #endif
772 
773 #if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
774  constexpr _Float128
775  acos(_Float128 __x)
776  { return __builtin_acosl(__x); }
777 
778  constexpr _Float128
779  asin(_Float128 __x)
780  { return __builtin_asinl(__x); }
781 
782  constexpr _Float128
783  atan(_Float128 __x)
784  { return __builtin_atanl(__x); }
785 
786  constexpr _Float128
787  atan2(_Float128 __y, _Float128 __x)
788  { return __builtin_atan2l(__y, __x); }
789 
790  constexpr _Float128
791  ceil(_Float128 __x)
792  { return __builtin_ceill(__x); }
793 
794  constexpr _Float128
795  cos(_Float128 __x)
796  { return __builtin_cosl(__x); }
797 
798  constexpr _Float128
799  cosh(_Float128 __x)
800  { return __builtin_coshl(__x); }
801 
802  constexpr _Float128
803  exp(_Float128 __x)
804  { return __builtin_expl(__x); }
805 
806  constexpr _Float128
807  fabs(_Float128 __x)
808  { return __builtin_fabsl(__x); }
809 
810  constexpr _Float128
811  floor(_Float128 __x)
812  { return __builtin_floorl(__x); }
813 
814  constexpr _Float128
815  fmod(_Float128 __x, _Float128 __y)
816  { return __builtin_fmodl(__x, __y); }
817 
818  inline _Float128
819  frexp(_Float128 __x, int* __exp)
820  { return __builtin_frexpl(__x, __exp); }
821 
822  constexpr _Float128
823  ldexp(_Float128 __x, int __exp)
824  { return __builtin_ldexpl(__x, __exp); }
825 
826  constexpr _Float128
827  log(_Float128 __x)
828  { return __builtin_logl(__x); }
829 
830  constexpr _Float128
831  log10(_Float128 __x)
832  { return __builtin_log10l(__x); }
833 
834  inline _Float128
835  modf(_Float128 __x, _Float128* __iptr)
836  {
837  long double __i, __ret = __builtin_modfl(__x, &__i);
838  *__iptr = __i;
839  return __ret;
840  }
841 
842  constexpr _Float128
843  pow(_Float128 __x, _Float128 __y)
844  { return __builtin_powl(__x, __y); }
845 
846  constexpr _Float128
847  sin(_Float128 __x)
848  { return __builtin_sinl(__x); }
849 
850  constexpr _Float128
851  sinh(_Float128 __x)
852  { return __builtin_sinhl(__x); }
853 
854  constexpr _Float128
855  sqrt(_Float128 __x)
856  { return __builtin_sqrtl(__x); }
857 
858  constexpr _Float128
859  tan(_Float128 __x)
860  { return __builtin_tanl(__x); }
861 
862  constexpr _Float128
863  tanh(_Float128 __x)
864  { return __builtin_tanhl(__x); }
865 #elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
866  constexpr _Float128
867  acos(_Float128 __x)
868  { return __builtin_acosf128(__x); }
869 
870  constexpr _Float128
871  asin(_Float128 __x)
872  { return __builtin_asinf128(__x); }
873 
874  constexpr _Float128
875  atan(_Float128 __x)
876  { return __builtin_atanf128(__x); }
877 
878  constexpr _Float128
879  atan2(_Float128 __y, _Float128 __x)
880  { return __builtin_atan2f128(__y, __x); }
881 
882  constexpr _Float128
883  ceil(_Float128 __x)
884  { return __builtin_ceilf128(__x); }
885 
886  constexpr _Float128
887  cos(_Float128 __x)
888  { return __builtin_cosf128(__x); }
889 
890  constexpr _Float128
891  cosh(_Float128 __x)
892  { return __builtin_coshf128(__x); }
893 
894  constexpr _Float128
895  exp(_Float128 __x)
896  { return __builtin_expf128(__x); }
897 
898  constexpr _Float128
899  fabs(_Float128 __x)
900  { return __builtin_fabsf128(__x); }
901 
902  constexpr _Float128
903  floor(_Float128 __x)
904  { return __builtin_floorf128(__x); }
905 
906  constexpr _Float128
907  fmod(_Float128 __x, _Float128 __y)
908  { return __builtin_fmodf128(__x, __y); }
909 
910  inline _Float128
911  frexp(_Float128 __x, int* __exp)
912  { return __builtin_frexpf128(__x, __exp); }
913 
914  constexpr _Float128
915  ldexp(_Float128 __x, int __exp)
916  { return __builtin_ldexpf128(__x, __exp); }
917 
918  constexpr _Float128
919  log(_Float128 __x)
920  { return __builtin_logf128(__x); }
921 
922  constexpr _Float128
923  log10(_Float128 __x)
924  { return __builtin_log10f128(__x); }
925 
926  inline _Float128
927  modf(_Float128 __x, _Float128* __iptr)
928  { return __builtin_modff128(__x, __iptr); }
929 
930  constexpr _Float128
931  pow(_Float128 __x, _Float128 __y)
932  { return __builtin_powf128(__x, __y); }
933 
934  constexpr _Float128
935  sin(_Float128 __x)
936  { return __builtin_sinf128(__x); }
937 
938  constexpr _Float128
939  sinh(_Float128 __x)
940  { return __builtin_sinhf128(__x); }
941 
942  constexpr _Float128
943  sqrt(_Float128 __x)
944  { return __builtin_sqrtf128(__x); }
945 
946  constexpr _Float128
947  tan(_Float128 __x)
948  { return __builtin_tanf128(__x); }
949 
950  constexpr _Float128
951  tanh(_Float128 __x)
952  { return __builtin_tanhf128(__x); }
953 #endif
954 
955 #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
956  constexpr __gnu_cxx::__bfloat16_t
957  acos(__gnu_cxx::__bfloat16_t __x)
958  { return __gnu_cxx::__bfloat16_t(__builtin_acosf(__x)); }
959 
960  constexpr __gnu_cxx::__bfloat16_t
961  asin(__gnu_cxx::__bfloat16_t __x)
962  { return __gnu_cxx::__bfloat16_t(__builtin_asinf(__x)); }
963 
964  constexpr __gnu_cxx::__bfloat16_t
965  atan(__gnu_cxx::__bfloat16_t __x)
966  { return __gnu_cxx::__bfloat16_t(__builtin_atanf(__x)); }
967 
968  constexpr __gnu_cxx::__bfloat16_t
969  atan2(__gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __x)
970  { return __gnu_cxx::__bfloat16_t(__builtin_atan2f(__y, __x)); }
971 
972  constexpr __gnu_cxx::__bfloat16_t
973  ceil(__gnu_cxx::__bfloat16_t __x)
974  { return __gnu_cxx::__bfloat16_t(__builtin_ceilf(__x)); }
975 
976  constexpr __gnu_cxx::__bfloat16_t
977  cos(__gnu_cxx::__bfloat16_t __x)
978  { return __gnu_cxx::__bfloat16_t(__builtin_cosf(__x)); }
979 
980  constexpr __gnu_cxx::__bfloat16_t
981  cosh(__gnu_cxx::__bfloat16_t __x)
982  { return __gnu_cxx::__bfloat16_t(__builtin_coshf(__x)); }
983 
984  constexpr __gnu_cxx::__bfloat16_t
985  exp(__gnu_cxx::__bfloat16_t __x)
986  { return __gnu_cxx::__bfloat16_t(__builtin_expf(__x)); }
987 
988  constexpr __gnu_cxx::__bfloat16_t
989  fabs(__gnu_cxx::__bfloat16_t __x)
990  { return __gnu_cxx::__bfloat16_t(__builtin_fabsf(__x)); }
991 
992  constexpr __gnu_cxx::__bfloat16_t
993  floor(__gnu_cxx::__bfloat16_t __x)
994  { return __gnu_cxx::__bfloat16_t(__builtin_floorf(__x)); }
995 
996  constexpr __gnu_cxx::__bfloat16_t
997  fmod(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
998  { return __gnu_cxx::__bfloat16_t(__builtin_fmodf(__x, __y)); }
999 
1000  inline __gnu_cxx::__bfloat16_t
1001  frexp(__gnu_cxx::__bfloat16_t __x, int* __exp)
1002  { return __gnu_cxx::__bfloat16_t(__builtin_frexpf(__x, __exp)); }
1003 
1004  constexpr __gnu_cxx::__bfloat16_t
1005  ldexp(__gnu_cxx::__bfloat16_t __x, int __exp)
1006  { return __gnu_cxx::__bfloat16_t(__builtin_ldexpf(__x, __exp)); }
1007 
1008  constexpr __gnu_cxx::__bfloat16_t
1009  log(__gnu_cxx::__bfloat16_t __x)
1010  { return __gnu_cxx::__bfloat16_t(__builtin_logf(__x)); }
1011 
1012  constexpr __gnu_cxx::__bfloat16_t
1013  log10(__gnu_cxx::__bfloat16_t __x)
1014  { return __gnu_cxx::__bfloat16_t(__builtin_log10f(__x)); }
1015 
1016  inline __gnu_cxx::__bfloat16_t
1017  modf(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t* __iptr)
1018  {
1019  float __i, __ret = __builtin_modff(__x, &__i);
1020  *__iptr = __gnu_cxx::__bfloat16_t(__i);
1021  return __gnu_cxx::__bfloat16_t(__ret);
1022  }
1023 
1024  constexpr __gnu_cxx::__bfloat16_t
1025  pow(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1026  { return __gnu_cxx::__bfloat16_t(__builtin_powf(__x, __y)); }
1027 
1028  constexpr __gnu_cxx::__bfloat16_t
1029  sin(__gnu_cxx::__bfloat16_t __x)
1030  { return __gnu_cxx::__bfloat16_t(__builtin_sinf(__x)); }
1031 
1032  constexpr __gnu_cxx::__bfloat16_t
1033  sinh(__gnu_cxx::__bfloat16_t __x)
1034  { return __gnu_cxx::__bfloat16_t(__builtin_sinhf(__x)); }
1035 
1036  constexpr __gnu_cxx::__bfloat16_t
1037  sqrt(__gnu_cxx::__bfloat16_t __x)
1038  { return __gnu_cxx::__bfloat16_t(__builtin_sqrtf(__x)); }
1039 
1040  constexpr __gnu_cxx::__bfloat16_t
1041  tan(__gnu_cxx::__bfloat16_t __x)
1042  { return __gnu_cxx::__bfloat16_t(__builtin_tanf(__x)); }
1043 
1044  constexpr __gnu_cxx::__bfloat16_t
1045  tanh(__gnu_cxx::__bfloat16_t __x)
1046  { return __gnu_cxx::__bfloat16_t(__builtin_tanhf(__x)); }
1047 #endif
1048 
1049  template<typename _Tp, typename _Up>
1050  inline _GLIBCXX_CONSTEXPR
1051  typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1052  atan2(_Tp __y, _Up __x)
1053  {
1054  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1055  return atan2(__type(__y), __type(__x));
1056  }
1057 
1058  template<typename _Tp, typename _Up>
1059  inline _GLIBCXX_CONSTEXPR
1060  typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1061  fmod(_Tp __x, _Up __y)
1062  {
1063  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1064  return fmod(__type(__x), __type(__y));
1065  }
1066 
1067  template<typename _Tp, typename _Up>
1068  inline _GLIBCXX_CONSTEXPR
1069  typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
1070  pow(_Tp __x, _Up __y)
1071  {
1072  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1073  return pow(__type(__x), __type(__y));
1074  }
1075 
1076 #if _GLIBCXX_USE_C99_MATH
1077 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
1078 
1079 // These are possible macros imported from C99-land.
1080 #undef fpclassify
1081 #undef isfinite
1082 #undef isinf
1083 #undef isnan
1084 #undef isnormal
1085 #undef signbit
1086 #undef isgreater
1087 #undef isgreaterequal
1088 #undef isless
1089 #undef islessequal
1090 #undef islessgreater
1091 #undef isunordered
1092 
1093 #if __cplusplus >= 201103L
1094 
1095 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1096  constexpr int
1097  fpclassify(float __x)
1098  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1099  FP_SUBNORMAL, FP_ZERO, __x); }
1100 
1101  constexpr int
1102  fpclassify(double __x)
1103  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1104  FP_SUBNORMAL, FP_ZERO, __x); }
1105 
1106  constexpr int
1107  fpclassify(long double __x)
1108  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1109  FP_SUBNORMAL, FP_ZERO, __x); }
1110 #endif
1111 
1112 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1113  template<typename _Tp>
1114  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1115  int>::__type
1116  fpclassify(_Tp __x)
1117  { return __x != 0 ? FP_NORMAL : FP_ZERO; }
1118 #endif
1119 
1120 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1121  constexpr bool
1122  isfinite(float __x)
1123  { return __builtin_isfinite(__x); }
1124 
1125  constexpr bool
1126  isfinite(double __x)
1127  { return __builtin_isfinite(__x); }
1128 
1129  constexpr bool
1130  isfinite(long double __x)
1131  { return __builtin_isfinite(__x); }
1132 #endif
1133 
1134 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1135  template<typename _Tp>
1136  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1137  bool>::__type
1138  isfinite(_Tp __x)
1139  { return true; }
1140 #endif
1141 
1142 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1143  constexpr bool
1144  isinf(float __x)
1145  { return __builtin_isinf(__x); }
1146 
1147 #if _GLIBCXX_HAVE_OBSOLETE_ISINF \
1148  && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
1149  using ::isinf;
1150 #else
1151  constexpr bool
1152  isinf(double __x)
1153  { return __builtin_isinf(__x); }
1154 #endif
1155 
1156  constexpr bool
1157  isinf(long double __x)
1158  { return __builtin_isinf(__x); }
1159 #endif
1160 
1161 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1162  template<typename _Tp>
1163  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1164  bool>::__type
1165  isinf(_Tp __x)
1166  { return false; }
1167 #endif
1168 
1169 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1170  constexpr bool
1171  isnan(float __x)
1172  { return __builtin_isnan(__x); }
1173 
1174 #if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
1175  && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
1176  using ::isnan;
1177 #else
1178  constexpr bool
1179  isnan(double __x)
1180  { return __builtin_isnan(__x); }
1181 #endif
1182 
1183  constexpr bool
1184  isnan(long double __x)
1185  { return __builtin_isnan(__x); }
1186 #endif
1187 
1188 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1189  template<typename _Tp>
1190  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1191  bool>::__type
1192  isnan(_Tp __x)
1193  { return false; }
1194 #endif
1195 
1196 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1197  constexpr bool
1198  isnormal(float __x)
1199  { return __builtin_isnormal(__x); }
1200 
1201  constexpr bool
1202  isnormal(double __x)
1203  { return __builtin_isnormal(__x); }
1204 
1205  constexpr bool
1206  isnormal(long double __x)
1207  { return __builtin_isnormal(__x); }
1208 #endif
1209 
1210 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1211  template<typename _Tp>
1212  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1213  bool>::__type
1214  isnormal(_Tp __x)
1215  { return __x != 0 ? true : false; }
1216 #endif
1217 
1218 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1219  // Note: middle-end/36757 is fixed, __builtin_signbit is type-generic.
1220  constexpr bool
1221  signbit(float __x)
1222  { return __builtin_signbit(__x); }
1223 
1224  constexpr bool
1225  signbit(double __x)
1226  { return __builtin_signbit(__x); }
1227 
1228  constexpr bool
1229  signbit(long double __x)
1230  { return __builtin_signbit(__x); }
1231 #endif
1232 
1233 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1234  template<typename _Tp>
1235  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
1236  bool>::__type
1237  signbit(_Tp __x)
1238  { return __x < 0 ? true : false; }
1239 #endif
1240 
1241 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1242  constexpr bool
1243  isgreater(float __x, float __y)
1244  { return __builtin_isgreater(__x, __y); }
1245 
1246  constexpr bool
1247  isgreater(double __x, double __y)
1248  { return __builtin_isgreater(__x, __y); }
1249 
1250  constexpr bool
1251  isgreater(long double __x, long double __y)
1252  { return __builtin_isgreater(__x, __y); }
1253 #endif
1254 
1255 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1256  template<typename _Tp, typename _Up>
1257  constexpr typename
1258  __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
1259  && __is_arithmetic<_Up>::__value), bool>::__type
1260  isgreater(_Tp __x, _Up __y)
1261  {
1262  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1263  return __builtin_isgreater(__type(__x), __type(__y));
1264  }
1265 #endif
1266 
1267 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1268  constexpr bool
1269  isgreaterequal(float __x, float __y)
1270  { return __builtin_isgreaterequal(__x, __y); }
1271 
1272  constexpr bool
1273  isgreaterequal(double __x, double __y)
1274  { return __builtin_isgreaterequal(__x, __y); }
1275 
1276  constexpr bool
1277  isgreaterequal(long double __x, long double __y)
1278  { return __builtin_isgreaterequal(__x, __y); }
1279 #endif
1280 
1281 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1282  template<typename _Tp, typename _Up>
1283  constexpr typename
1284  __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
1285  && __is_arithmetic<_Up>::__value), bool>::__type
1286  isgreaterequal(_Tp __x, _Up __y)
1287  {
1288  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1289  return __builtin_isgreaterequal(__type(__x), __type(__y));
1290  }
1291 #endif
1292 
1293 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1294  constexpr bool
1295  isless(float __x, float __y)
1296  { return __builtin_isless(__x, __y); }
1297 
1298  constexpr bool
1299  isless(double __x, double __y)
1300  { return __builtin_isless(__x, __y); }
1301 
1302  constexpr bool
1303  isless(long double __x, long double __y)
1304  { return __builtin_isless(__x, __y); }
1305 #endif
1306 
1307 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1308  template<typename _Tp, typename _Up>
1309  constexpr typename
1310  __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
1311  && __is_arithmetic<_Up>::__value), bool>::__type
1312  isless(_Tp __x, _Up __y)
1313  {
1314  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1315  return __builtin_isless(__type(__x), __type(__y));
1316  }
1317 #endif
1318 
1319 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1320  constexpr bool
1321  islessequal(float __x, float __y)
1322  { return __builtin_islessequal(__x, __y); }
1323 
1324  constexpr bool
1325  islessequal(double __x, double __y)
1326  { return __builtin_islessequal(__x, __y); }
1327 
1328  constexpr bool
1329  islessequal(long double __x, long double __y)
1330  { return __builtin_islessequal(__x, __y); }
1331 #endif
1332 
1333 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1334  template<typename _Tp, typename _Up>
1335  constexpr typename
1336  __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
1337  && __is_arithmetic<_Up>::__value), bool>::__type
1338  islessequal(_Tp __x, _Up __y)
1339  {
1340  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1341  return __builtin_islessequal(__type(__x), __type(__y));
1342  }
1343 #endif
1344 
1345 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1346  constexpr bool
1347  islessgreater(float __x, float __y)
1348  { return __builtin_islessgreater(__x, __y); }
1349 
1350  constexpr bool
1351  islessgreater(double __x, double __y)
1352  { return __builtin_islessgreater(__x, __y); }
1353 
1354  constexpr bool
1355  islessgreater(long double __x, long double __y)
1356  { return __builtin_islessgreater(__x, __y); }
1357 #endif
1358 
1359 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1360  template<typename _Tp, typename _Up>
1361  constexpr typename
1362  __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
1363  && __is_arithmetic<_Up>::__value), bool>::__type
1364  islessgreater(_Tp __x, _Up __y)
1365  {
1366  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1367  return __builtin_islessgreater(__type(__x), __type(__y));
1368  }
1369 #endif
1370 
1371 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
1372  constexpr bool
1373  isunordered(float __x, float __y)
1374  { return __builtin_isunordered(__x, __y); }
1375 
1376  constexpr bool
1377  isunordered(double __x, double __y)
1378  { return __builtin_isunordered(__x, __y); }
1379 
1380  constexpr bool
1381  isunordered(long double __x, long double __y)
1382  { return __builtin_isunordered(__x, __y); }
1383 #endif
1384 
1385 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
1386  template<typename _Tp, typename _Up>
1387  constexpr typename
1388  __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value
1389  && __is_arithmetic<_Up>::__value), bool>::__type
1390  isunordered(_Tp __x, _Up __y)
1391  {
1392  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
1393  return __builtin_isunordered(__type(__x), __type(__y));
1394  }
1395 #endif
1396 
1397 #else
1398 
1399  template<typename _Tp>
1400  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1401  int>::__type
1402  fpclassify(_Tp __f)
1403  {
1404  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1405  return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1406  FP_SUBNORMAL, FP_ZERO, __type(__f));
1407  }
1408 
1409  template<typename _Tp>
1410  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1411  int>::__type
1412  isfinite(_Tp __f)
1413  {
1414  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1415  return __builtin_isfinite(__type(__f));
1416  }
1417 
1418  template<typename _Tp>
1419  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1420  int>::__type
1421  isinf(_Tp __f)
1422  {
1423  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1424  return __builtin_isinf(__type(__f));
1425  }
1426 
1427  template<typename _Tp>
1428  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1429  int>::__type
1430  isnan(_Tp __f)
1431  {
1432  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1433  return __builtin_isnan(__type(__f));
1434  }
1435 
1436  template<typename _Tp>
1437  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1438  int>::__type
1439  isnormal(_Tp __f)
1440  {
1441  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1442  return __builtin_isnormal(__type(__f));
1443  }
1444 
1445  template<typename _Tp>
1446  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1447  int>::__type
1448  signbit(_Tp __f)
1449  {
1450  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1451  return __builtin_signbit(__type(__f));
1452  }
1453 
1454  template<typename _Tp>
1455  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1456  int>::__type
1457  isgreater(_Tp __f1, _Tp __f2)
1458  {
1459  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1460  return __builtin_isgreater(__type(__f1), __type(__f2));
1461  }
1462 
1463  template<typename _Tp>
1464  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1465  int>::__type
1466  isgreaterequal(_Tp __f1, _Tp __f2)
1467  {
1468  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1469  return __builtin_isgreaterequal(__type(__f1), __type(__f2));
1470  }
1471 
1472  template<typename _Tp>
1473  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1474  int>::__type
1475  isless(_Tp __f1, _Tp __f2)
1476  {
1477  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1478  return __builtin_isless(__type(__f1), __type(__f2));
1479  }
1480 
1481  template<typename _Tp>
1482  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1483  int>::__type
1484  islessequal(_Tp __f1, _Tp __f2)
1485  {
1486  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1487  return __builtin_islessequal(__type(__f1), __type(__f2));
1488  }
1489 
1490  template<typename _Tp>
1491  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1492  int>::__type
1493  islessgreater(_Tp __f1, _Tp __f2)
1494  {
1495  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1496  return __builtin_islessgreater(__type(__f1), __type(__f2));
1497  }
1498 
1499  template<typename _Tp>
1500  inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value,
1501  int>::__type
1502  isunordered(_Tp __f1, _Tp __f2)
1503  {
1504  typedef typename __gnu_cxx::__promote<_Tp>::__type __type;
1505  return __builtin_isunordered(__type(__f1), __type(__f2));
1506  }
1507 
1508 #endif // C++11
1509 
1510 #ifdef __STDCPP_FLOAT16_T__
1511  constexpr int
1512  fpclassify(_Float16 __x)
1513  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1514  FP_SUBNORMAL, FP_ZERO, __x); }
1515 
1516  constexpr bool
1517  isfinite(_Float16 __x)
1518  { return __builtin_isfinite(__x); }
1519 
1520  constexpr bool
1521  isinf(_Float16 __x)
1522  { return __builtin_isinf(__x); }
1523 
1524  constexpr bool
1525  isnan(_Float16 __x)
1526  { return __builtin_isnan(__x); }
1527 
1528  constexpr bool
1529  isnormal(_Float16 __x)
1530  { return __builtin_isnormal(__x); }
1531 
1532  constexpr bool
1533  signbit(_Float16 __x)
1534  { return __builtin_signbit(__x); }
1535 
1536  constexpr bool
1537  isgreater(_Float16 __x, _Float16 __y)
1538  { return __builtin_isgreater(__x, __y); }
1539 
1540  constexpr bool
1541  isgreaterequal(_Float16 __x, _Float16 __y)
1542  { return __builtin_isgreaterequal(__x, __y); }
1543 
1544  constexpr bool
1545  isless(_Float16 __x, _Float16 __y)
1546  { return __builtin_isless(__x, __y); }
1547 
1548  constexpr bool
1549  islessequal(_Float16 __x, _Float16 __y)
1550  { return __builtin_islessequal(__x, __y); }
1551 
1552  constexpr bool
1553  islessgreater(_Float16 __x, _Float16 __y)
1554  { return __builtin_islessgreater(__x, __y); }
1555 
1556  constexpr bool
1557  isunordered(_Float16 __x, _Float16 __y)
1558  { return __builtin_isunordered(__x, __y); }
1559 #endif
1560 
1561 #ifdef __STDCPP_FLOAT32_T__
1562  constexpr int
1563  fpclassify(_Float32 __x)
1564  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1565  FP_SUBNORMAL, FP_ZERO, __x); }
1566 
1567  constexpr bool
1568  isfinite(_Float32 __x)
1569  { return __builtin_isfinite(__x); }
1570 
1571  constexpr bool
1572  isinf(_Float32 __x)
1573  { return __builtin_isinf(__x); }
1574 
1575  constexpr bool
1576  isnan(_Float32 __x)
1577  { return __builtin_isnan(__x); }
1578 
1579  constexpr bool
1580  isnormal(_Float32 __x)
1581  { return __builtin_isnormal(__x); }
1582 
1583  constexpr bool
1584  signbit(_Float32 __x)
1585  { return __builtin_signbit(__x); }
1586 
1587  constexpr bool
1588  isgreater(_Float32 __x, _Float32 __y)
1589  { return __builtin_isgreater(__x, __y); }
1590 
1591  constexpr bool
1592  isgreaterequal(_Float32 __x, _Float32 __y)
1593  { return __builtin_isgreaterequal(__x, __y); }
1594 
1595  constexpr bool
1596  isless(_Float32 __x, _Float32 __y)
1597  { return __builtin_isless(__x, __y); }
1598 
1599  constexpr bool
1600  islessequal(_Float32 __x, _Float32 __y)
1601  { return __builtin_islessequal(__x, __y); }
1602 
1603  constexpr bool
1604  islessgreater(_Float32 __x, _Float32 __y)
1605  { return __builtin_islessgreater(__x, __y); }
1606 
1607  constexpr bool
1608  isunordered(_Float32 __x, _Float32 __y)
1609  { return __builtin_isunordered(__x, __y); }
1610 #endif
1611 
1612 #ifdef __STDCPP_FLOAT64_T__
1613  constexpr int
1614  fpclassify(_Float64 __x)
1615  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1616  FP_SUBNORMAL, FP_ZERO, __x); }
1617 
1618  constexpr bool
1619  isfinite(_Float64 __x)
1620  { return __builtin_isfinite(__x); }
1621 
1622  constexpr bool
1623  isinf(_Float64 __x)
1624  { return __builtin_isinf(__x); }
1625 
1626  constexpr bool
1627  isnan(_Float64 __x)
1628  { return __builtin_isnan(__x); }
1629 
1630  constexpr bool
1631  isnormal(_Float64 __x)
1632  { return __builtin_isnormal(__x); }
1633 
1634  constexpr bool
1635  signbit(_Float64 __x)
1636  { return __builtin_signbit(__x); }
1637 
1638  constexpr bool
1639  isgreater(_Float64 __x, _Float64 __y)
1640  { return __builtin_isgreater(__x, __y); }
1641 
1642  constexpr bool
1643  isgreaterequal(_Float64 __x, _Float64 __y)
1644  { return __builtin_isgreaterequal(__x, __y); }
1645 
1646  constexpr bool
1647  isless(_Float64 __x, _Float64 __y)
1648  { return __builtin_isless(__x, __y); }
1649 
1650  constexpr bool
1651  islessequal(_Float64 __x, _Float64 __y)
1652  { return __builtin_islessequal(__x, __y); }
1653 
1654  constexpr bool
1655  islessgreater(_Float64 __x, _Float64 __y)
1656  { return __builtin_islessgreater(__x, __y); }
1657 
1658  constexpr bool
1659  isunordered(_Float64 __x, _Float64 __y)
1660  { return __builtin_isunordered(__x, __y); }
1661 #endif
1662 
1663 #ifdef __STDCPP_FLOAT128_T__
1664  constexpr int
1665  fpclassify(_Float128 __x)
1666  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1667  FP_SUBNORMAL, FP_ZERO, __x); }
1668 
1669  constexpr bool
1670  isfinite(_Float128 __x)
1671  { return __builtin_isfinite(__x); }
1672 
1673  constexpr bool
1674  isinf(_Float128 __x)
1675  { return __builtin_isinf(__x); }
1676 
1677  constexpr bool
1678  isnan(_Float128 __x)
1679  { return __builtin_isnan(__x); }
1680 
1681  constexpr bool
1682  isnormal(_Float128 __x)
1683  { return __builtin_isnormal(__x); }
1684 
1685  constexpr bool
1686  signbit(_Float128 __x)
1687  { return __builtin_signbit(__x); }
1688 
1689  constexpr bool
1690  isgreater(_Float128 __x, _Float128 __y)
1691  { return __builtin_isgreater(__x, __y); }
1692 
1693  constexpr bool
1694  isgreaterequal(_Float128 __x, _Float128 __y)
1695  { return __builtin_isgreaterequal(__x, __y); }
1696 
1697  constexpr bool
1698  isless(_Float128 __x, _Float128 __y)
1699  { return __builtin_isless(__x, __y); }
1700 
1701  constexpr bool
1702  islessequal(_Float128 __x, _Float128 __y)
1703  { return __builtin_islessequal(__x, __y); }
1704 
1705  constexpr bool
1706  islessgreater(_Float128 __x, _Float128 __y)
1707  { return __builtin_islessgreater(__x, __y); }
1708 
1709  constexpr bool
1710  isunordered(_Float128 __x, _Float128 __y)
1711  { return __builtin_isunordered(__x, __y); }
1712 #endif
1713 
1714 #ifdef __STDCPP_BFLOAT16_T__
1715  constexpr int
1716  fpclassify(__gnu_cxx::__bfloat16_t __x)
1717  { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL,
1718  FP_SUBNORMAL, FP_ZERO, __x); }
1719 
1720  constexpr bool
1721  isfinite(__gnu_cxx::__bfloat16_t __x)
1722  { return __builtin_isfinite(__x); }
1723 
1724  constexpr bool
1725  isinf(__gnu_cxx::__bfloat16_t __x)
1726  { return __builtin_isinf(__x); }
1727 
1728  constexpr bool
1729  isnan(__gnu_cxx::__bfloat16_t __x)
1730  { return __builtin_isnan(__x); }
1731 
1732  constexpr bool
1733  isnormal(__gnu_cxx::__bfloat16_t __x)
1734  { return __builtin_isnormal(__x); }
1735 
1736  constexpr bool
1737  signbit(__gnu_cxx::__bfloat16_t __x)
1738  { return __builtin_signbit(__x); }
1739 
1740  constexpr bool
1741  isgreater(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1742  { return __builtin_isgreater(__x, __y); }
1743 
1744  constexpr bool
1745  isgreaterequal(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1746  { return __builtin_isgreaterequal(__x, __y); }
1747 
1748  constexpr bool
1749  isless(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1750  { return __builtin_isless(__x, __y); }
1751 
1752  constexpr bool
1753  islessequal(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1754  { return __builtin_islessequal(__x, __y); }
1755 
1756  constexpr bool
1757  islessgreater(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1758  { return __builtin_islessgreater(__x, __y); }
1759 
1760  constexpr bool
1761  isunordered(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
1762  { return __builtin_isunordered(__x, __y); }
1763 #endif
1764 
1765 #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */
1766 #endif /* _GLIBCXX_USE_C99_MATH */
1767 
1768 #if __cplusplus >= 201103L
1769 
1770 #ifdef _GLIBCXX_USE_C99_MATH_TR1
1771 
1772 #undef acosh
1773 #undef acoshf
1774 #undef acoshl
1775 #undef asinh
1776 #undef asinhf
1777 #undef asinhl
1778 #undef atanh
1779 #undef atanhf
1780 #undef atanhl
1781 #undef cbrt
1782 #undef cbrtf
1783 #undef cbrtl
1784 #undef copysign
1785 #undef copysignf
1786 #undef copysignl
1787 #undef erf
1788 #undef erff
1789 #undef erfl
1790 #undef erfc
1791 #undef erfcf
1792 #undef erfcl
1793 #undef exp2
1794 #undef exp2f
1795 #undef exp2l
1796 #undef expm1
1797 #undef expm1f
1798 #undef expm1l
1799 #undef fdim
1800 #undef fdimf
1801 #undef fdiml
1802 #undef fma
1803 #undef fmaf
1804 #undef fmal
1805 #undef fmax
1806 #undef fmaxf
1807 #undef fmaxl
1808 #undef fmin
1809 #undef fminf
1810 #undef fminl
1811 #undef hypot
1812 #undef hypotf
1813 #undef hypotl
1814 #undef ilogb
1815 #undef ilogbf
1816 #undef ilogbl
1817 #undef lgamma
1818 #undef lgammaf
1819 #undef lgammal
1820 #ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
1821 #undef llrint
1822 #undef llrintf
1823 #undef llrintl
1824 #undef llround
1825 #undef llroundf
1826 #undef llroundl
1827 #endif
1828 #undef log1p
1829 #undef log1pf
1830 #undef log1pl
1831 #undef log2
1832 #undef log2f
1833 #undef log2l
1834 #undef logb
1835 #undef logbf
1836 #undef logbl
1837 #undef lrint
1838 #undef lrintf
1839 #undef lrintl
1840 #undef lround
1841 #undef lroundf
1842 #undef lroundl
1843 #undef nan
1844 #undef nanf
1845 #undef nanl
1846 #undef nearbyint
1847 #undef nearbyintf
1848 #undef nearbyintl
1849 #undef nextafter
1850 #undef nextafterf
1851 #undef nextafterl
1852 #undef nexttoward
1853 #undef nexttowardf
1854 #undef nexttowardl
1855 #undef remainder
1856 #undef remainderf
1857 #undef remainderl
1858 #undef remquo
1859 #undef remquof
1860 #undef remquol
1861 #undef rint
1862 #undef rintf
1863 #undef rintl
1864 #undef round
1865 #undef roundf
1866 #undef roundl
1867 #undef scalbln
1868 #undef scalblnf
1869 #undef scalblnl
1870 #undef scalbn
1871 #undef scalbnf
1872 #undef scalbnl
1873 #undef tgamma
1874 #undef tgammaf
1875 #undef tgammal
1876 #undef trunc
1877 #undef truncf
1878 #undef truncl
1879 
1880  // types
1881  using ::double_t;
1882  using ::float_t;
1883 
1884  // functions
1885  using ::acosh;
1886  using ::acoshf;
1887  using ::acoshl;
1888 
1889  using ::asinh;
1890  using ::asinhf;
1891  using ::asinhl;
1892 
1893  using ::atanh;
1894  using ::atanhf;
1895  using ::atanhl;
1896 
1897  using ::cbrt;
1898  using ::cbrtf;
1899  using ::cbrtl;
1900 
1901  using ::copysign;
1902  using ::copysignf;
1903  using ::copysignl;
1904 
1905  using ::erf;
1906  using ::erff;
1907  using ::erfl;
1908 
1909  using ::erfc;
1910  using ::erfcf;
1911  using ::erfcl;
1912 
1913  using ::exp2;
1914  using ::exp2f;
1915  using ::exp2l;
1916 
1917  using ::expm1;
1918  using ::expm1f;
1919  using ::expm1l;
1920 
1921  using ::fdim;
1922  using ::fdimf;
1923  using ::fdiml;
1924 
1925  using ::fma;
1926  using ::fmaf;
1927  using ::fmal;
1928 
1929  using ::fmax;
1930  using ::fmaxf;
1931  using ::fmaxl;
1932 
1933  using ::fmin;
1934  using ::fminf;
1935  using ::fminl;
1936 
1937  using ::hypot;
1938  using ::hypotf;
1939  using ::hypotl;
1940 
1941  using ::ilogb;
1942  using ::ilogbf;
1943  using ::ilogbl;
1944 
1945  using ::lgamma;
1946  using ::lgammaf;
1947  using ::lgammal;
1948 
1949 #ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS
1950  using ::llrint;
1951  using ::llrintf;
1952  using ::llrintl;
1953 
1954  using ::llround;
1955  using ::llroundf;
1956  using ::llroundl;
1957 #endif
1958 
1959  using ::log1p;
1960  using ::log1pf;
1961  using ::log1pl;
1962 
1963  using ::log2;
1964  using ::log2f;
1965  using ::log2l;
1966 
1967  using ::logb;
1968  using ::logbf;
1969  using ::logbl;
1970 
1971  using ::lrint;
1972  using ::lrintf;
1973  using ::lrintl;
1974 
1975  using ::lround;
1976  using ::lroundf;
1977  using ::lroundl;
1978 
1979  using ::nan;
1980  using ::nanf;
1981  using ::nanl;
1982 
1983  using ::nearbyint;
1984  using ::nearbyintf;
1985  using ::nearbyintl;
1986 
1987  using ::nextafter;
1988  using ::nextafterf;
1989  using ::nextafterl;
1990 
1991  using ::nexttoward;
1992  using ::nexttowardf;
1993  using ::nexttowardl;
1994 
1995  using ::remainder;
1996  using ::remainderf;
1997  using ::remainderl;
1998 
1999  using ::remquo;
2000  using ::remquof;
2001  using ::remquol;
2002 
2003  using ::rint;
2004  using ::rintf;
2005  using ::rintl;
2006 
2007  using ::round;
2008  using ::roundf;
2009  using ::roundl;
2010 
2011  using ::scalbln;
2012  using ::scalblnf;
2013  using ::scalblnl;
2014 
2015  using ::scalbn;
2016  using ::scalbnf;
2017  using ::scalbnl;
2018 
2019  using ::tgamma;
2020  using ::tgammaf;
2021  using ::tgammal;
2022 
2023  using ::trunc;
2024  using ::truncf;
2025  using ::truncl;
2026 
2027  /// Additional overloads.
2028 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2029  constexpr float
2030  acosh(float __x)
2031  { return __builtin_acoshf(__x); }
2032 
2033  constexpr long double
2034  acosh(long double __x)
2035  { return __builtin_acoshl(__x); }
2036 #endif
2037 
2038 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2039  template<typename _Tp>
2040  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2041  double>::__type
2042  acosh(_Tp __x)
2043  { return __builtin_acosh(__x); }
2044 #endif
2045 
2046 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2047  constexpr float
2048  asinh(float __x)
2049  { return __builtin_asinhf(__x); }
2050 
2051  constexpr long double
2052  asinh(long double __x)
2053  { return __builtin_asinhl(__x); }
2054 #endif
2055 
2056 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2057  template<typename _Tp>
2058  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2059  double>::__type
2060  asinh(_Tp __x)
2061  { return __builtin_asinh(__x); }
2062 #endif
2063 
2064 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2065  constexpr float
2066  atanh(float __x)
2067  { return __builtin_atanhf(__x); }
2068 
2069  constexpr long double
2070  atanh(long double __x)
2071  { return __builtin_atanhl(__x); }
2072 #endif
2073 
2074 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2075  template<typename _Tp>
2076  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2077  double>::__type
2078  atanh(_Tp __x)
2079  { return __builtin_atanh(__x); }
2080 #endif
2081 
2082 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2083  constexpr float
2084  cbrt(float __x)
2085  { return __builtin_cbrtf(__x); }
2086 
2087  constexpr long double
2088  cbrt(long double __x)
2089  { return __builtin_cbrtl(__x); }
2090 #endif
2091 
2092 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2093  template<typename _Tp>
2094  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2095  double>::__type
2096  cbrt(_Tp __x)
2097  { return __builtin_cbrt(__x); }
2098 #endif
2099 
2100 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2101  constexpr float
2102  copysign(float __x, float __y)
2103  { return __builtin_copysignf(__x, __y); }
2104 
2105  constexpr long double
2106  copysign(long double __x, long double __y)
2107  { return __builtin_copysignl(__x, __y); }
2108 #endif
2109 
2110 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2111  constexpr float
2112  erf(float __x)
2113  { return __builtin_erff(__x); }
2114 
2115  constexpr long double
2116  erf(long double __x)
2117  { return __builtin_erfl(__x); }
2118 #endif
2119 
2120 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2121  template<typename _Tp>
2122  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2123  double>::__type
2124  erf(_Tp __x)
2125  { return __builtin_erf(__x); }
2126 #endif
2127 
2128 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2129  constexpr float
2130  erfc(float __x)
2131  { return __builtin_erfcf(__x); }
2132 
2133  constexpr long double
2134  erfc(long double __x)
2135  { return __builtin_erfcl(__x); }
2136 #endif
2137 
2138 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2139  template<typename _Tp>
2140  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2141  double>::__type
2142  erfc(_Tp __x)
2143  { return __builtin_erfc(__x); }
2144 #endif
2145 
2146 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2147  constexpr float
2148  exp2(float __x)
2149  { return __builtin_exp2f(__x); }
2150 
2151  constexpr long double
2152  exp2(long double __x)
2153  { return __builtin_exp2l(__x); }
2154 #endif
2155 
2156 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2157  template<typename _Tp>
2158  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2159  double>::__type
2160  exp2(_Tp __x)
2161  { return __builtin_exp2(__x); }
2162 #endif
2163 
2164 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2165  constexpr float
2166  expm1(float __x)
2167  { return __builtin_expm1f(__x); }
2168 
2169  constexpr long double
2170  expm1(long double __x)
2171  { return __builtin_expm1l(__x); }
2172 #endif
2173 
2174 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2175  template<typename _Tp>
2176  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2177  double>::__type
2178  expm1(_Tp __x)
2179  { return __builtin_expm1(__x); }
2180 #endif
2181 
2182 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2183  constexpr float
2184  fdim(float __x, float __y)
2185  { return __builtin_fdimf(__x, __y); }
2186 
2187  constexpr long double
2188  fdim(long double __x, long double __y)
2189  { return __builtin_fdiml(__x, __y); }
2190 #endif
2191 
2192 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2193  constexpr float
2194  fma(float __x, float __y, float __z)
2195  { return __builtin_fmaf(__x, __y, __z); }
2196 
2197  constexpr long double
2198  fma(long double __x, long double __y, long double __z)
2199  { return __builtin_fmal(__x, __y, __z); }
2200 #endif
2201 
2202 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2203  constexpr float
2204  fmax(float __x, float __y)
2205  { return __builtin_fmaxf(__x, __y); }
2206 
2207  constexpr long double
2208  fmax(long double __x, long double __y)
2209  { return __builtin_fmaxl(__x, __y); }
2210 #endif
2211 
2212 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2213  constexpr float
2214  fmin(float __x, float __y)
2215  { return __builtin_fminf(__x, __y); }
2216 
2217  constexpr long double
2218  fmin(long double __x, long double __y)
2219  { return __builtin_fminl(__x, __y); }
2220 #endif
2221 
2222 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2223  constexpr float
2224  hypot(float __x, float __y)
2225  { return __builtin_hypotf(__x, __y); }
2226 
2227  constexpr long double
2228  hypot(long double __x, long double __y)
2229  { return __builtin_hypotl(__x, __y); }
2230 #endif
2231 
2232 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2233  constexpr int
2234  ilogb(float __x)
2235  { return __builtin_ilogbf(__x); }
2236 
2237  constexpr int
2238  ilogb(long double __x)
2239  { return __builtin_ilogbl(__x); }
2240 #endif
2241 
2242 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2243  template<typename _Tp>
2244  constexpr
2245  typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2246  int>::__type
2247  ilogb(_Tp __x)
2248  { return __builtin_ilogb(__x); }
2249 #endif
2250 
2251 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2252  constexpr float
2253  lgamma(float __x)
2254  { return __builtin_lgammaf(__x); }
2255 
2256  constexpr long double
2257  lgamma(long double __x)
2258  { return __builtin_lgammal(__x); }
2259 #endif
2260 
2261 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2262  template<typename _Tp>
2263  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2264  double>::__type
2265  lgamma(_Tp __x)
2266  { return __builtin_lgamma(__x); }
2267 #endif
2268 
2269 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2270  constexpr long long
2271  llrint(float __x)
2272  { return __builtin_llrintf(__x); }
2273 
2274  constexpr long long
2275  llrint(long double __x)
2276  { return __builtin_llrintl(__x); }
2277 #endif
2278 
2279 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2280  template<typename _Tp>
2281  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2282  long long>::__type
2283  llrint(_Tp __x)
2284  { return __builtin_llrint(__x); }
2285 #endif
2286 
2287 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2288  constexpr long long
2289  llround(float __x)
2290  { return __builtin_llroundf(__x); }
2291 
2292  constexpr long long
2293  llround(long double __x)
2294  { return __builtin_llroundl(__x); }
2295 #endif
2296 
2297 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2298  template<typename _Tp>
2299  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2300  long long>::__type
2301  llround(_Tp __x)
2302  { return __builtin_llround(__x); }
2303 #endif
2304 
2305 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2306  constexpr float
2307  log1p(float __x)
2308  { return __builtin_log1pf(__x); }
2309 
2310  constexpr long double
2311  log1p(long double __x)
2312  { return __builtin_log1pl(__x); }
2313 #endif
2314 
2315 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2316  template<typename _Tp>
2317  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2318  double>::__type
2319  log1p(_Tp __x)
2320  { return __builtin_log1p(__x); }
2321 #endif
2322 
2323 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2324  // DR 568.
2325  constexpr float
2326  log2(float __x)
2327  { return __builtin_log2f(__x); }
2328 
2329  constexpr long double
2330  log2(long double __x)
2331  { return __builtin_log2l(__x); }
2332 #endif
2333 
2334 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2335  template<typename _Tp>
2336  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2337  double>::__type
2338  log2(_Tp __x)
2339  { return __builtin_log2(__x); }
2340 #endif
2341 
2342 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2343  constexpr float
2344  logb(float __x)
2345  { return __builtin_logbf(__x); }
2346 
2347  constexpr long double
2348  logb(long double __x)
2349  { return __builtin_logbl(__x); }
2350 #endif
2351 
2352 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2353  template<typename _Tp>
2354  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2355  double>::__type
2356  logb(_Tp __x)
2357  { return __builtin_logb(__x); }
2358 #endif
2359 
2360 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2361  constexpr long
2362  lrint(float __x)
2363  { return __builtin_lrintf(__x); }
2364 
2365  constexpr long
2366  lrint(long double __x)
2367  { return __builtin_lrintl(__x); }
2368 #endif
2369 
2370 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2371  template<typename _Tp>
2372  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2373  long>::__type
2374  lrint(_Tp __x)
2375  { return __builtin_lrint(__x); }
2376 #endif
2377 
2378 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2379  constexpr long
2380  lround(float __x)
2381  { return __builtin_lroundf(__x); }
2382 
2383  constexpr long
2384  lround(long double __x)
2385  { return __builtin_lroundl(__x); }
2386 #endif
2387 
2388 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2389  template<typename _Tp>
2390  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2391  long>::__type
2392  lround(_Tp __x)
2393  { return __builtin_lround(__x); }
2394 #endif
2395 
2396 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2397  constexpr float
2398  nearbyint(float __x)
2399  { return __builtin_nearbyintf(__x); }
2400 
2401  constexpr long double
2402  nearbyint(long double __x)
2403  { return __builtin_nearbyintl(__x); }
2404 #endif
2405 
2406 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2407  template<typename _Tp>
2408  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2409  double>::__type
2410  nearbyint(_Tp __x)
2411  { return __builtin_nearbyint(__x); }
2412 #endif
2413 
2414 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2415  constexpr float
2416  nextafter(float __x, float __y)
2417  { return __builtin_nextafterf(__x, __y); }
2418 
2419  constexpr long double
2420  nextafter(long double __x, long double __y)
2421  { return __builtin_nextafterl(__x, __y); }
2422 #endif
2423 
2424 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2425  constexpr float
2426  nexttoward(float __x, long double __y)
2427  { return __builtin_nexttowardf(__x, __y); }
2428 
2429  constexpr long double
2430  nexttoward(long double __x, long double __y)
2431  { return __builtin_nexttowardl(__x, __y); }
2432 #endif
2433 
2434 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2435  template<typename _Tp>
2436  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2437  double>::__type
2438  nexttoward(_Tp __x, long double __y)
2439  { return __builtin_nexttoward(__x, __y); }
2440 #endif
2441 
2442 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2443  constexpr float
2444  remainder(float __x, float __y)
2445  { return __builtin_remainderf(__x, __y); }
2446 
2447  constexpr long double
2448  remainder(long double __x, long double __y)
2449  { return __builtin_remainderl(__x, __y); }
2450 #endif
2451 
2452 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2453  inline float
2454  remquo(float __x, float __y, int* __pquo)
2455  { return __builtin_remquof(__x, __y, __pquo); }
2456 
2457  inline long double
2458  remquo(long double __x, long double __y, int* __pquo)
2459  { return __builtin_remquol(__x, __y, __pquo); }
2460 #endif
2461 
2462 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2463  constexpr float
2464  rint(float __x)
2465  { return __builtin_rintf(__x); }
2466 
2467  constexpr long double
2468  rint(long double __x)
2469  { return __builtin_rintl(__x); }
2470 #endif
2471 
2472 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2473  template<typename _Tp>
2474  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2475  double>::__type
2476  rint(_Tp __x)
2477  { return __builtin_rint(__x); }
2478 #endif
2479 
2480 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2481  constexpr float
2482  round(float __x)
2483  { return __builtin_roundf(__x); }
2484 
2485  constexpr long double
2486  round(long double __x)
2487  { return __builtin_roundl(__x); }
2488 #endif
2489 
2490 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2491  template<typename _Tp>
2492  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2493  double>::__type
2494  round(_Tp __x)
2495  { return __builtin_round(__x); }
2496 #endif
2497 
2498 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2499  constexpr float
2500  scalbln(float __x, long __ex)
2501  { return __builtin_scalblnf(__x, __ex); }
2502 
2503  constexpr long double
2504  scalbln(long double __x, long __ex)
2505  { return __builtin_scalblnl(__x, __ex); }
2506 #endif
2507 
2508 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2509  template<typename _Tp>
2510  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2511  double>::__type
2512  scalbln(_Tp __x, long __ex)
2513  { return __builtin_scalbln(__x, __ex); }
2514 #endif
2515 
2516 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2517  constexpr float
2518  scalbn(float __x, int __ex)
2519  { return __builtin_scalbnf(__x, __ex); }
2520 
2521  constexpr long double
2522  scalbn(long double __x, int __ex)
2523  { return __builtin_scalbnl(__x, __ex); }
2524 #endif
2525 
2526 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2527  template<typename _Tp>
2528  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2529  double>::__type
2530  scalbn(_Tp __x, int __ex)
2531  { return __builtin_scalbn(__x, __ex); }
2532 #endif
2533 
2534 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2535  constexpr float
2536  tgamma(float __x)
2537  { return __builtin_tgammaf(__x); }
2538 
2539  constexpr long double
2540  tgamma(long double __x)
2541  { return __builtin_tgammal(__x); }
2542 #endif
2543 
2544 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2545  template<typename _Tp>
2546  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2547  double>::__type
2548  tgamma(_Tp __x)
2549  { return __builtin_tgamma(__x); }
2550 #endif
2551 
2552 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
2553  constexpr float
2554  trunc(float __x)
2555  { return __builtin_truncf(__x); }
2556 
2557  constexpr long double
2558  trunc(long double __x)
2559  { return __builtin_truncl(__x); }
2560 #endif
2561 
2562 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
2563  template<typename _Tp>
2564  constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
2565  double>::__type
2566  trunc(_Tp __x)
2567  { return __builtin_trunc(__x); }
2568 #endif
2569 
2570 #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
2571  constexpr _Float16
2572  acosh(_Float16 __x)
2573  { return _Float16(__builtin_acoshf(__x)); }
2574 
2575  constexpr _Float16
2576  asinh(_Float16 __x)
2577  { return _Float16(__builtin_asinhf(__x)); }
2578 
2579  constexpr _Float16
2580  atanh(_Float16 __x)
2581  { return _Float16(__builtin_atanhf(__x)); }
2582 
2583  constexpr _Float16
2584  cbrt(_Float16 __x)
2585  { return _Float16(__builtin_cbrtf(__x)); }
2586 
2587  constexpr _Float16
2588  copysign(_Float16 __x, _Float16 __y)
2589  { return __builtin_copysignf16(__x, __y); }
2590 
2591  constexpr _Float16
2592  erf(_Float16 __x)
2593  { return _Float16(__builtin_erff(__x)); }
2594 
2595  constexpr _Float16
2596  erfc(_Float16 __x)
2597  { return _Float16(__builtin_erfcf(__x)); }
2598 
2599  constexpr _Float16
2600  exp2(_Float16 __x)
2601  { return _Float16(__builtin_exp2f(__x)); }
2602 
2603  constexpr _Float16
2604  expm1(_Float16 __x)
2605  { return _Float16(__builtin_expm1f(__x)); }
2606 
2607  constexpr _Float16
2608  fdim(_Float16 __x, _Float16 __y)
2609  { return _Float16(__builtin_fdimf(__x, __y)); }
2610 
2611  constexpr _Float16
2612  fma(_Float16 __x, _Float16 __y, _Float16 __z)
2613  { return _Float16(__builtin_fmaf(__x, __y, __z)); }
2614 
2615  constexpr _Float16
2616  fmax(_Float16 __x, _Float16 __y)
2617  { return _Float16(__builtin_fmaxf(__x, __y)); }
2618 
2619  constexpr _Float16
2620  fmin(_Float16 __x, _Float16 __y)
2621  { return _Float16(__builtin_fminf(__x, __y)); }
2622 
2623  constexpr _Float16
2624  hypot(_Float16 __x, _Float16 __y)
2625  { return _Float16(__builtin_hypotf(__x, __y)); }
2626 
2627  constexpr int
2628  ilogb(_Float16 __x)
2629  { return _Float16(__builtin_ilogbf(__x)); }
2630 
2631  constexpr _Float16
2632  lgamma(_Float16 __x)
2633  { return _Float16(__builtin_lgammaf(__x)); }
2634 
2635  constexpr long long
2636  llrint(_Float16 __x)
2637  { return _Float16(__builtin_llrintf(__x)); }
2638 
2639  constexpr long long
2640  llround(_Float16 __x)
2641  { return _Float16(__builtin_llroundf(__x)); }
2642 
2643  constexpr _Float16
2644  log1p(_Float16 __x)
2645  { return _Float16(__builtin_log1pf(__x)); }
2646 
2647  // DR 568.
2648  constexpr _Float16
2649  log2(_Float16 __x)
2650  { return _Float16(__builtin_log2f(__x)); }
2651 
2652  constexpr _Float16
2653  logb(_Float16 __x)
2654  { return _Float16(__builtin_logbf(__x)); }
2655 
2656  constexpr long
2657  lrint(_Float16 __x)
2658  { return _Float16(__builtin_lrintf(__x)); }
2659 
2660  constexpr long
2661  lround(_Float16 __x)
2662  { return _Float16(__builtin_lroundf(__x)); }
2663 
2664  constexpr _Float16
2665  nearbyint(_Float16 __x)
2666  { return _Float16(__builtin_nearbyintf(__x)); }
2667 
2668  constexpr _Float16
2669  nextafter(_Float16 __x, _Float16 __y)
2670  {
2671  if (std::__is_constant_evaluated())
2672  return __builtin_nextafterf16(__x, __y);
2673 #ifdef __INT16_TYPE__
2674  using __float16_int_type = __INT16_TYPE__;
2675 #else
2676  using __float16_int_type = short int;
2677 #endif
2678  __float16_int_type __hx, __hy, __ix, __iy;
2679  __builtin_memcpy(&__hx, &__x, sizeof(__x));
2680  __builtin_memcpy(&__hy, &__y, sizeof(__x));
2681  __ix = __hx & 0x7fff; // |x|
2682  __iy = __hy & 0x7fff; // |y|
2683  if (__ix > 0x7c00 || __iy > 0x7c00) // x or y is NaN
2684  return __x + __y;
2685  if (__x == __y)
2686  return __y; // x == y, return y
2687  if (__ix == 0) // x == 0
2688  {
2689  __hy = (__hy & 0x8000) | 1; // return +-__FLT16_DENORM_MIN__
2690  __builtin_memcpy(&__x, &__hy, sizeof(__x));
2691  __builtin_nextafterf(0.0f, 1.0f); // raise underflow
2692  return __x;
2693  }
2694  if (__hx >= 0) // x > 0
2695  {
2696  if (__hx > __hy) // x > y, x -= ulp
2697  --__hx;
2698  else // x < y, x += ulp
2699  ++__hx;
2700  }
2701  else // x < 0
2702  {
2703  if (__hy >= 0 || __hx > __hy) // x < y, x -= ulp
2704  --__hx;
2705  else // x > y, x += ulp
2706  ++__hx;
2707  }
2708  __hy = __hx & 0x7c00;
2709  if (__hy >= 0x7c00)
2710  __builtin_nextafterf(__FLT_MAX__, __builtin_inff()); // overflow
2711  else if (__hy < 0x0400)
2712  __builtin_nextafterf(__FLT_MIN__, 0.0f); // underflow
2713  __builtin_memcpy(&__x, &__hx, sizeof(__x));
2714  return __x;
2715  }
2716 
2717  constexpr _Float16
2718  remainder(_Float16 __x, _Float16 __y)
2719  { return _Float16(__builtin_remainderf(__x, __y)); }
2720 
2721  inline _Float16
2722  remquo(_Float16 __x, _Float16 __y, int* __pquo)
2723  { return _Float16(__builtin_remquof(__x, __y, __pquo)); }
2724 
2725  constexpr _Float16
2726  rint(_Float16 __x)
2727  { return _Float16(__builtin_rintf(__x)); }
2728 
2729  constexpr _Float16
2730  round(_Float16 __x)
2731  { return _Float16(__builtin_roundf(__x)); }
2732 
2733  constexpr _Float16
2734  scalbln(_Float16 __x, long __ex)
2735  { return _Float16(__builtin_scalblnf(__x, __ex)); }
2736 
2737  constexpr _Float16
2738  scalbn(_Float16 __x, int __ex)
2739  { return _Float16(__builtin_scalbnf(__x, __ex)); }
2740 
2741  constexpr _Float16
2742  tgamma(_Float16 __x)
2743  { return _Float16(__builtin_tgammaf(__x)); }
2744 
2745  constexpr _Float16
2746  trunc(_Float16 __x)
2747  { return _Float16(__builtin_truncf(__x)); }
2748 #endif
2749 
2750 #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
2751  constexpr _Float32
2752  acosh(_Float32 __x)
2753  { return __builtin_acoshf(__x); }
2754 
2755  constexpr _Float32
2756  asinh(_Float32 __x)
2757  { return __builtin_asinhf(__x); }
2758 
2759  constexpr _Float32
2760  atanh(_Float32 __x)
2761  { return __builtin_atanhf(__x); }
2762 
2763  constexpr _Float32
2764  cbrt(_Float32 __x)
2765  { return __builtin_cbrtf(__x); }
2766 
2767  constexpr _Float32
2768  copysign(_Float32 __x, _Float32 __y)
2769  { return __builtin_copysignf(__x, __y); }
2770 
2771  constexpr _Float32
2772  erf(_Float32 __x)
2773  { return __builtin_erff(__x); }
2774 
2775  constexpr _Float32
2776  erfc(_Float32 __x)
2777  { return __builtin_erfcf(__x); }
2778 
2779  constexpr _Float32
2780  exp2(_Float32 __x)
2781  { return __builtin_exp2f(__x); }
2782 
2783  constexpr _Float32
2784  expm1(_Float32 __x)
2785  { return __builtin_expm1f(__x); }
2786 
2787  constexpr _Float32
2788  fdim(_Float32 __x, _Float32 __y)
2789  { return __builtin_fdimf(__x, __y); }
2790 
2791  constexpr _Float32
2792  fma(_Float32 __x, _Float32 __y, _Float32 __z)
2793  { return __builtin_fmaf(__x, __y, __z); }
2794 
2795  constexpr _Float32
2796  fmax(_Float32 __x, _Float32 __y)
2797  { return __builtin_fmaxf(__x, __y); }
2798 
2799  constexpr _Float32
2800  fmin(_Float32 __x, _Float32 __y)
2801  { return __builtin_fminf(__x, __y); }
2802 
2803  constexpr _Float32
2804  hypot(_Float32 __x, _Float32 __y)
2805  { return __builtin_hypotf(__x, __y); }
2806 
2807  constexpr int
2808  ilogb(_Float32 __x)
2809  { return __builtin_ilogbf(__x); }
2810 
2811  constexpr _Float32
2812  lgamma(_Float32 __x)
2813  { return __builtin_lgammaf(__x); }
2814 
2815  constexpr long long
2816  llrint(_Float32 __x)
2817  { return __builtin_llrintf(__x); }
2818 
2819  constexpr long long
2820  llround(_Float32 __x)
2821  { return __builtin_llroundf(__x); }
2822 
2823  constexpr _Float32
2824  log1p(_Float32 __x)
2825  { return __builtin_log1pf(__x); }
2826 
2827  // DR 568.
2828  constexpr _Float32
2829  log2(_Float32 __x)
2830  { return __builtin_log2f(__x); }
2831 
2832  constexpr _Float32
2833  logb(_Float32 __x)
2834  { return __builtin_logbf(__x); }
2835 
2836  constexpr long
2837  lrint(_Float32 __x)
2838  { return __builtin_lrintf(__x); }
2839 
2840  constexpr long
2841  lround(_Float32 __x)
2842  { return __builtin_lroundf(__x); }
2843 
2844  constexpr _Float32
2845  nearbyint(_Float32 __x)
2846  { return __builtin_nearbyintf(__x); }
2847 
2848  constexpr _Float32
2849  nextafter(_Float32 __x, _Float32 __y)
2850  { return __builtin_nextafterf(__x, __y); }
2851 
2852  constexpr _Float32
2853  remainder(_Float32 __x, _Float32 __y)
2854  { return __builtin_remainderf(__x, __y); }
2855 
2856  inline _Float32
2857  remquo(_Float32 __x, _Float32 __y, int* __pquo)
2858  { return __builtin_remquof(__x, __y, __pquo); }
2859 
2860  constexpr _Float32
2861  rint(_Float32 __x)
2862  { return __builtin_rintf(__x); }
2863 
2864  constexpr _Float32
2865  round(_Float32 __x)
2866  { return __builtin_roundf(__x); }
2867 
2868  constexpr _Float32
2869  scalbln(_Float32 __x, long __ex)
2870  { return __builtin_scalblnf(__x, __ex); }
2871 
2872  constexpr _Float32
2873  scalbn(_Float32 __x, int __ex)
2874  { return __builtin_scalbnf(__x, __ex); }
2875 
2876  constexpr _Float32
2877  tgamma(_Float32 __x)
2878  { return __builtin_tgammaf(__x); }
2879 
2880  constexpr _Float32
2881  trunc(_Float32 __x)
2882  { return __builtin_truncf(__x); }
2883 #endif
2884 
2885 #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
2886  constexpr _Float64
2887  acosh(_Float64 __x)
2888  { return __builtin_acosh(__x); }
2889 
2890  constexpr _Float64
2891  asinh(_Float64 __x)
2892  { return __builtin_asinh(__x); }
2893 
2894  constexpr _Float64
2895  atanh(_Float64 __x)
2896  { return __builtin_atanh(__x); }
2897 
2898  constexpr _Float64
2899  cbrt(_Float64 __x)
2900  { return __builtin_cbrt(__x); }
2901 
2902  constexpr _Float64
2903  copysign(_Float64 __x, _Float64 __y)
2904  { return __builtin_copysign(__x, __y); }
2905 
2906  constexpr _Float64
2907  erf(_Float64 __x)
2908  { return __builtin_erf(__x); }
2909 
2910  constexpr _Float64
2911  erfc(_Float64 __x)
2912  { return __builtin_erfc(__x); }
2913 
2914  constexpr _Float64
2915  exp2(_Float64 __x)
2916  { return __builtin_exp2(__x); }
2917 
2918  constexpr _Float64
2919  expm1(_Float64 __x)
2920  { return __builtin_expm1(__x); }
2921 
2922  constexpr _Float64
2923  fdim(_Float64 __x, _Float64 __y)
2924  { return __builtin_fdim(__x, __y); }
2925 
2926  constexpr _Float64
2927  fma(_Float64 __x, _Float64 __y, _Float64 __z)
2928  { return __builtin_fma(__x, __y, __z); }
2929 
2930  constexpr _Float64
2931  fmax(_Float64 __x, _Float64 __y)
2932  { return __builtin_fmax(__x, __y); }
2933 
2934  constexpr _Float64
2935  fmin(_Float64 __x, _Float64 __y)
2936  { return __builtin_fmin(__x, __y); }
2937 
2938  constexpr _Float64
2939  hypot(_Float64 __x, _Float64 __y)
2940  { return __builtin_hypot(__x, __y); }
2941 
2942  constexpr int
2943  ilogb(_Float64 __x)
2944  { return __builtin_ilogb(__x); }
2945 
2946  constexpr _Float64
2947  lgamma(_Float64 __x)
2948  { return __builtin_lgamma(__x); }
2949 
2950  constexpr long long
2951  llrint(_Float64 __x)
2952  { return __builtin_llrint(__x); }
2953 
2954  constexpr long long
2955  llround(_Float64 __x)
2956  { return __builtin_llround(__x); }
2957 
2958  constexpr _Float64
2959  log1p(_Float64 __x)
2960  { return __builtin_log1p(__x); }
2961 
2962  // DR 568.
2963  constexpr _Float64
2964  log2(_Float64 __x)
2965  { return __builtin_log2(__x); }
2966 
2967  constexpr _Float64
2968  logb(_Float64 __x)
2969  { return __builtin_logb(__x); }
2970 
2971  constexpr long
2972  lrint(_Float64 __x)
2973  { return __builtin_lrint(__x); }
2974 
2975  constexpr long
2976  lround(_Float64 __x)
2977  { return __builtin_lround(__x); }
2978 
2979  constexpr _Float64
2980  nearbyint(_Float64 __x)
2981  { return __builtin_nearbyint(__x); }
2982 
2983  constexpr _Float64
2984  nextafter(_Float64 __x, _Float64 __y)
2985  { return __builtin_nextafter(__x, __y); }
2986 
2987  constexpr _Float64
2988  remainder(_Float64 __x, _Float64 __y)
2989  { return __builtin_remainder(__x, __y); }
2990 
2991  inline _Float64
2992  remquo(_Float64 __x, _Float64 __y, int* __pquo)
2993  { return __builtin_remquo(__x, __y, __pquo); }
2994 
2995  constexpr _Float64
2996  rint(_Float64 __x)
2997  { return __builtin_rint(__x); }
2998 
2999  constexpr _Float64
3000  round(_Float64 __x)
3001  { return __builtin_round(__x); }
3002 
3003  constexpr _Float64
3004  scalbln(_Float64 __x, long __ex)
3005  { return __builtin_scalbln(__x, __ex); }
3006 
3007  constexpr _Float64
3008  scalbn(_Float64 __x, int __ex)
3009  { return __builtin_scalbn(__x, __ex); }
3010 
3011  constexpr _Float64
3012  tgamma(_Float64 __x)
3013  { return __builtin_tgamma(__x); }
3014 
3015  constexpr _Float64
3016  trunc(_Float64 __x)
3017  { return __builtin_trunc(__x); }
3018 #endif
3019 
3020 #if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
3021  constexpr _Float128
3022  acosh(_Float128 __x)
3023  { return __builtin_acoshl(__x); }
3024 
3025  constexpr _Float128
3026  asinh(_Float128 __x)
3027  { return __builtin_asinhl(__x); }
3028 
3029  constexpr _Float128
3030  atanh(_Float128 __x)
3031  { return __builtin_atanhl(__x); }
3032 
3033  constexpr _Float128
3034  cbrt(_Float128 __x)
3035  { return __builtin_cbrtl(__x); }
3036 
3037  constexpr _Float128
3038  copysign(_Float128 __x, _Float128 __y)
3039  { return __builtin_copysignl(__x, __y); }
3040 
3041  constexpr _Float128
3042  erf(_Float128 __x)
3043  { return __builtin_erfl(__x); }
3044 
3045  constexpr _Float128
3046  erfc(_Float128 __x)
3047  { return __builtin_erfcl(__x); }
3048 
3049  constexpr _Float128
3050  exp2(_Float128 __x)
3051  { return __builtin_exp2l(__x); }
3052 
3053  constexpr _Float128
3054  expm1(_Float128 __x)
3055  { return __builtin_expm1l(__x); }
3056 
3057  constexpr _Float128
3058  fdim(_Float128 __x, _Float128 __y)
3059  { return __builtin_fdiml(__x, __y); }
3060 
3061  constexpr _Float128
3062  fma(_Float128 __x, _Float128 __y, _Float128 __z)
3063  { return __builtin_fmal(__x, __y, __z); }
3064 
3065  constexpr _Float128
3066  fmax(_Float128 __x, _Float128 __y)
3067  { return __builtin_fmaxl(__x, __y); }
3068 
3069  constexpr _Float128
3070  fmin(_Float128 __x, _Float128 __y)
3071  { return __builtin_fminl(__x, __y); }
3072 
3073  constexpr _Float128
3074  hypot(_Float128 __x, _Float128 __y)
3075  { return __builtin_hypotl(__x, __y); }
3076 
3077  constexpr int
3078  ilogb(_Float128 __x)
3079  { return __builtin_ilogbl(__x); }
3080 
3081  constexpr _Float128
3082  lgamma(_Float128 __x)
3083  { return __builtin_lgammal(__x); }
3084 
3085  constexpr long long
3086  llrint(_Float128 __x)
3087  { return __builtin_llrintl(__x); }
3088 
3089  constexpr long long
3090  llround(_Float128 __x)
3091  { return __builtin_llroundl(__x); }
3092 
3093  constexpr _Float128
3094  log1p(_Float128 __x)
3095  { return __builtin_log1pl(__x); }
3096 
3097  // DR 568.
3098  constexpr _Float128
3099  log2(_Float128 __x)
3100  { return __builtin_log2l(__x); }
3101 
3102  constexpr _Float128
3103  logb(_Float128 __x)
3104  { return __builtin_logbl(__x); }
3105 
3106  constexpr long
3107  lrint(_Float128 __x)
3108  { return __builtin_lrintl(__x); }
3109 
3110  constexpr long
3111  lround(_Float128 __x)
3112  { return __builtin_lroundl(__x); }
3113 
3114  constexpr _Float128
3115  nearbyint(_Float128 __x)
3116  { return __builtin_nearbyintl(__x); }
3117 
3118  constexpr _Float128
3119  nextafter(_Float128 __x, _Float128 __y)
3120  { return __builtin_nextafterl(__x, __y); }
3121 
3122  constexpr _Float128
3123  remainder(_Float128 __x, _Float128 __y)
3124  { return __builtin_remainderl(__x, __y); }
3125 
3126  inline _Float128
3127  remquo(_Float128 __x, _Float128 __y, int* __pquo)
3128  { return __builtin_remquol(__x, __y, __pquo); }
3129 
3130  constexpr _Float128
3131  rint(_Float128 __x)
3132  { return __builtin_rintl(__x); }
3133 
3134  constexpr _Float128
3135  round(_Float128 __x)
3136  { return __builtin_roundl(__x); }
3137 
3138  constexpr _Float128
3139  scalbln(_Float128 __x, long __ex)
3140  { return __builtin_scalblnl(__x, __ex); }
3141 
3142  constexpr _Float128
3143  scalbn(_Float128 __x, int __ex)
3144  { return __builtin_scalbnl(__x, __ex); }
3145 
3146  constexpr _Float128
3147  tgamma(_Float128 __x)
3148  { return __builtin_tgammal(__x); }
3149 
3150  constexpr _Float128
3151  trunc(_Float128 __x)
3152  { return __builtin_truncl(__x); }
3153 #elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH)
3154  constexpr _Float128
3155  acosh(_Float128 __x)
3156  { return __builtin_acoshf128(__x); }
3157 
3158  constexpr _Float128
3159  asinh(_Float128 __x)
3160  { return __builtin_asinhf128(__x); }
3161 
3162  constexpr _Float128
3163  atanh(_Float128 __x)
3164  { return __builtin_atanhf128(__x); }
3165 
3166  constexpr _Float128
3167  cbrt(_Float128 __x)
3168  { return __builtin_cbrtf128(__x); }
3169 
3170  constexpr _Float128
3171  copysign(_Float128 __x, _Float128 __y)
3172  { return __builtin_copysignf128(__x, __y); }
3173 
3174  constexpr _Float128
3175  erf(_Float128 __x)
3176  { return __builtin_erff128(__x); }
3177 
3178  constexpr _Float128
3179  erfc(_Float128 __x)
3180  { return __builtin_erfcf128(__x); }
3181 
3182  constexpr _Float128
3183  exp2(_Float128 __x)
3184  { return __builtin_exp2f128(__x); }
3185 
3186  constexpr _Float128
3187  expm1(_Float128 __x)
3188  { return __builtin_expm1f128(__x); }
3189 
3190  constexpr _Float128
3191  fdim(_Float128 __x, _Float128 __y)
3192  { return __builtin_fdimf128(__x, __y); }
3193 
3194  constexpr _Float128
3195  fma(_Float128 __x, _Float128 __y, _Float128 __z)
3196  { return __builtin_fmaf128(__x, __y, __z); }
3197 
3198  constexpr _Float128
3199  fmax(_Float128 __x, _Float128 __y)
3200  { return __builtin_fmaxf128(__x, __y); }
3201 
3202  constexpr _Float128
3203  fmin(_Float128 __x, _Float128 __y)
3204  { return __builtin_fminf128(__x, __y); }
3205 
3206  constexpr _Float128
3207  hypot(_Float128 __x, _Float128 __y)
3208  { return __builtin_hypotf128(__x, __y); }
3209 
3210  constexpr int
3211  ilogb(_Float128 __x)
3212  { return __builtin_ilogbf128(__x); }
3213 
3214  constexpr _Float128
3215  lgamma(_Float128 __x)
3216  { return __builtin_lgammaf128(__x); }
3217 
3218  constexpr long long
3219  llrint(_Float128 __x)
3220  { return __builtin_llrintf128(__x); }
3221 
3222  constexpr long long
3223  llround(_Float128 __x)
3224  { return __builtin_llroundf128(__x); }
3225 
3226  constexpr _Float128
3227  log1p(_Float128 __x)
3228  { return __builtin_log1pf128(__x); }
3229 
3230  // DR 568.
3231  constexpr _Float128
3232  log2(_Float128 __x)
3233  { return __builtin_log2f128(__x); }
3234 
3235  constexpr _Float128
3236  logb(_Float128 __x)
3237  { return __builtin_logbf128(__x); }
3238 
3239  constexpr long
3240  lrint(_Float128 __x)
3241  { return __builtin_lrintf128(__x); }
3242 
3243  constexpr long
3244  lround(_Float128 __x)
3245  { return __builtin_lroundf128(__x); }
3246 
3247  constexpr _Float128
3248  nearbyint(_Float128 __x)
3249  { return __builtin_nearbyintf128(__x); }
3250 
3251  constexpr _Float128
3252  nextafter(_Float128 __x, _Float128 __y)
3253  { return __builtin_nextafterf128(__x, __y); }
3254 
3255  constexpr _Float128
3256  remainder(_Float128 __x, _Float128 __y)
3257  { return __builtin_remainderf128(__x, __y); }
3258 
3259  inline _Float128
3260  remquo(_Float128 __x, _Float128 __y, int* __pquo)
3261  { return __builtin_remquof128(__x, __y, __pquo); }
3262 
3263  constexpr _Float128
3264  rint(_Float128 __x)
3265  { return __builtin_rintf128(__x); }
3266 
3267  constexpr _Float128
3268  round(_Float128 __x)
3269  { return __builtin_roundf128(__x); }
3270 
3271  constexpr _Float128
3272  scalbln(_Float128 __x, long __ex)
3273  { return __builtin_scalblnf128(__x, __ex); }
3274 
3275  constexpr _Float128
3276  scalbn(_Float128 __x, int __ex)
3277  { return __builtin_scalbnf128(__x, __ex); }
3278 
3279  constexpr _Float128
3280  tgamma(_Float128 __x)
3281  { return __builtin_tgammaf128(__x); }
3282 
3283  constexpr _Float128
3284  trunc(_Float128 __x)
3285  { return __builtin_truncf128(__x); }
3286 #endif
3287 
3288 #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3289  constexpr __gnu_cxx::__bfloat16_t
3290  acosh(__gnu_cxx::__bfloat16_t __x)
3291  { return __gnu_cxx::__bfloat16_t(__builtin_acoshf(__x)); }
3292 
3293  constexpr __gnu_cxx::__bfloat16_t
3294  asinh(__gnu_cxx::__bfloat16_t __x)
3295  { return __gnu_cxx::__bfloat16_t(__builtin_asinhf(__x)); }
3296 
3297  constexpr __gnu_cxx::__bfloat16_t
3298  atanh(__gnu_cxx::__bfloat16_t __x)
3299  { return __gnu_cxx::__bfloat16_t(__builtin_atanhf(__x)); }
3300 
3301  constexpr __gnu_cxx::__bfloat16_t
3302  cbrt(__gnu_cxx::__bfloat16_t __x)
3303  { return __gnu_cxx::__bfloat16_t(__builtin_cbrtf(__x)); }
3304 
3305  constexpr __gnu_cxx::__bfloat16_t
3306  copysign(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3307  { return __gnu_cxx::__bfloat16_t(__builtin_copysignf(__x, __y)); }
3308 
3309  constexpr __gnu_cxx::__bfloat16_t
3310  erf(__gnu_cxx::__bfloat16_t __x)
3311  { return __gnu_cxx::__bfloat16_t(__builtin_erff(__x)); }
3312 
3313  constexpr __gnu_cxx::__bfloat16_t
3314  erfc(__gnu_cxx::__bfloat16_t __x)
3315  { return __gnu_cxx::__bfloat16_t(__builtin_erfcf(__x)); }
3316 
3317  constexpr __gnu_cxx::__bfloat16_t
3318  exp2(__gnu_cxx::__bfloat16_t __x)
3319  { return __gnu_cxx::__bfloat16_t(__builtin_exp2f(__x)); }
3320 
3321  constexpr __gnu_cxx::__bfloat16_t
3322  expm1(__gnu_cxx::__bfloat16_t __x)
3323  { return __gnu_cxx::__bfloat16_t(__builtin_expm1f(__x)); }
3324 
3325  constexpr __gnu_cxx::__bfloat16_t
3326  fdim(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3327  { return __gnu_cxx::__bfloat16_t(__builtin_fdimf(__x, __y)); }
3328 
3329  constexpr __gnu_cxx::__bfloat16_t
3330  fma(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z)
3331  { return __gnu_cxx::__bfloat16_t(__builtin_fmaf(__x, __y, __z)); }
3332 
3333  constexpr __gnu_cxx::__bfloat16_t
3334  fmax(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3335  { return __gnu_cxx::__bfloat16_t(__builtin_fmaxf(__x, __y)); }
3336 
3337  constexpr __gnu_cxx::__bfloat16_t
3338  fmin(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3339  { return __gnu_cxx::__bfloat16_t(__builtin_fminf(__x, __y)); }
3340 
3341  constexpr __gnu_cxx::__bfloat16_t
3342  hypot(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3343  { return __gnu_cxx::__bfloat16_t(__builtin_hypotf(__x, __y)); }
3344 
3345  constexpr int
3346  ilogb(__gnu_cxx::__bfloat16_t __x)
3347  { return __gnu_cxx::__bfloat16_t(__builtin_ilogbf(__x)); }
3348 
3349  constexpr __gnu_cxx::__bfloat16_t
3350  lgamma(__gnu_cxx::__bfloat16_t __x)
3351  { return __gnu_cxx::__bfloat16_t(__builtin_lgammaf(__x)); }
3352 
3353  constexpr long long
3354  llrint(__gnu_cxx::__bfloat16_t __x)
3355  { return __gnu_cxx::__bfloat16_t(__builtin_llrintf(__x)); }
3356 
3357  constexpr long long
3358  llround(__gnu_cxx::__bfloat16_t __x)
3359  { return __gnu_cxx::__bfloat16_t(__builtin_llroundf(__x)); }
3360 
3361  constexpr __gnu_cxx::__bfloat16_t
3362  log1p(__gnu_cxx::__bfloat16_t __x)
3363  { return __gnu_cxx::__bfloat16_t(__builtin_log1pf(__x)); }
3364 
3365  // DR 568.
3366  constexpr __gnu_cxx::__bfloat16_t
3367  log2(__gnu_cxx::__bfloat16_t __x)
3368  { return __gnu_cxx::__bfloat16_t(__builtin_log2f(__x)); }
3369 
3370  constexpr __gnu_cxx::__bfloat16_t
3371  logb(__gnu_cxx::__bfloat16_t __x)
3372  { return __gnu_cxx::__bfloat16_t(__builtin_logbf(__x)); }
3373 
3374  constexpr long
3375  lrint(__gnu_cxx::__bfloat16_t __x)
3376  { return __gnu_cxx::__bfloat16_t(__builtin_lrintf(__x)); }
3377 
3378  constexpr long
3379  lround(__gnu_cxx::__bfloat16_t __x)
3380  { return __gnu_cxx::__bfloat16_t(__builtin_lroundf(__x)); }
3381 
3382  constexpr __gnu_cxx::__bfloat16_t
3383  nearbyint(__gnu_cxx::__bfloat16_t __x)
3384  { return __gnu_cxx::__bfloat16_t(__builtin_nearbyintf(__x)); }
3385 
3386  constexpr __gnu_cxx::__bfloat16_t
3387  nextafter(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3388  {
3389  if (std::__is_constant_evaluated())
3390  return __builtin_nextafterf16b(__x, __y);
3391 #ifdef __INT16_TYPE__
3392  using __bfloat16_int_type = __INT16_TYPE__;
3393 #else
3394  using __bfloat16_int_type = short int;
3395 #endif
3396  __bfloat16_int_type __hx, __hy, __ix, __iy;
3397  __builtin_memcpy(&__hx, &__x, sizeof(__x));
3398  __builtin_memcpy(&__hy, &__y, sizeof(__x));
3399  __ix = __hx & 0x7fff; // |x|
3400  __iy = __hy & 0x7fff; // |y|
3401  if (__ix > 0x7f80 || __iy > 0x7f80) // x or y is NaN
3402  return __x + __y;
3403  if (__x == __y)
3404  return __y; // x == y, return y
3405  if (__ix == 0) // x == 0
3406  {
3407  __hy = (__hy & 0x8000) | 1; // return +-__BFLT16_DENORM_MIN__
3408  __builtin_memcpy(&__x, &__hy, sizeof(__x));
3409  __builtin_nextafterf(0.0f, 1.0f); // raise underflow
3410  return __x;
3411  }
3412  if (__hx >= 0) // x > 0
3413  {
3414  if (__hx > __hy) // x > y, x -= ulp
3415  --__hx;
3416  else // x < y, x += ulp
3417  ++__hx;
3418  }
3419  else // x < 0
3420  {
3421  if (__hy >= 0 || __hx > __hy) // x < y, x -= ulp
3422  --__hx;
3423  else // x > y, x += ulp
3424  ++__hx;
3425  }
3426  __hy = __hx & 0x7f80;
3427  if (__hy >= 0x7f80)
3428  __builtin_nextafterf(__FLT_MAX__, __builtin_inff()); // overflow
3429  else if (__hy < 0x0080)
3430  __builtin_nextafterf(__FLT_MIN__, 0.0f); // underflow
3431  __builtin_memcpy(&__x, &__hx, sizeof(__x));
3432  return __x;
3433  }
3434 
3435  constexpr __gnu_cxx::__bfloat16_t
3436  remainder(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y)
3437  { return __gnu_cxx::__bfloat16_t(__builtin_remainderf(__x, __y)); }
3438 
3439  inline __gnu_cxx::__bfloat16_t
3440  remquo(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, int* __pquo)
3441  { return __gnu_cxx::__bfloat16_t(__builtin_remquof(__x, __y, __pquo)); }
3442 
3443  constexpr __gnu_cxx::__bfloat16_t
3444  rint(__gnu_cxx::__bfloat16_t __x)
3445  { return __gnu_cxx::__bfloat16_t(__builtin_rintf(__x)); }
3446 
3447  constexpr __gnu_cxx::__bfloat16_t
3448  round(__gnu_cxx::__bfloat16_t __x)
3449  { return __gnu_cxx::__bfloat16_t(__builtin_roundf(__x)); }
3450 
3451  constexpr __gnu_cxx::__bfloat16_t
3452  scalbln(__gnu_cxx::__bfloat16_t __x, long __ex)
3453  { return __gnu_cxx::__bfloat16_t(__builtin_scalblnf(__x, __ex)); }
3454 
3455  constexpr __gnu_cxx::__bfloat16_t
3456  scalbn(__gnu_cxx::__bfloat16_t __x, int __ex)
3457  { return __gnu_cxx::__bfloat16_t(__builtin_scalbnf(__x, __ex)); }
3458 
3459  constexpr __gnu_cxx::__bfloat16_t
3460  tgamma(__gnu_cxx::__bfloat16_t __x)
3461  { return __gnu_cxx::__bfloat16_t(__builtin_tgammaf(__x)); }
3462 
3463  constexpr __gnu_cxx::__bfloat16_t
3464  trunc(__gnu_cxx::__bfloat16_t __x)
3465  { return __gnu_cxx::__bfloat16_t(__builtin_truncf(__x)); }
3466 #endif
3467 
3468 #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
3469  template<typename _Tp, typename _Up>
3470  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3471  copysign(_Tp __x, _Up __y)
3472  {
3473  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3474  return copysign(__type(__x), __type(__y));
3475  }
3476 
3477  template<typename _Tp, typename _Up>
3478  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3479  fdim(_Tp __x, _Up __y)
3480  {
3481  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3482  return fdim(__type(__x), __type(__y));
3483  }
3484 
3485  template<typename _Tp, typename _Up>
3486  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3487  fmax(_Tp __x, _Up __y)
3488  {
3489  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3490  return fmax(__type(__x), __type(__y));
3491  }
3492 
3493  template<typename _Tp, typename _Up>
3494  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3495  fmin(_Tp __x, _Up __y)
3496  {
3497  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3498  return fmin(__type(__x), __type(__y));
3499  }
3500 
3501  template<typename _Tp, typename _Up>
3502  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3503  hypot(_Tp __x, _Up __y)
3504  {
3505  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3506  return hypot(__type(__x), __type(__y));
3507  }
3508 
3509  template<typename _Tp, typename _Up>
3510  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3511  nextafter(_Tp __x, _Up __y)
3512  {
3513  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3514  return nextafter(__type(__x), __type(__y));
3515  }
3516 
3517  template<typename _Tp, typename _Up>
3518  constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3519  remainder(_Tp __x, _Up __y)
3520  {
3521  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3522  return remainder(__type(__x), __type(__y));
3523  }
3524 
3525  template<typename _Tp, typename _Up>
3526  inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type
3527  remquo(_Tp __x, _Up __y, int* __pquo)
3528  {
3529  typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type;
3530  return remquo(__type(__x), __type(__y), __pquo);
3531  }
3532 
3533  template<typename _Tp, typename _Up, typename _Vp>
3534  constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type
3535  fma(_Tp __x, _Up __y, _Vp __z)
3536  {
3537  typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type;
3538  return fma(__type(__x), __type(__y), __type(__z));
3539  }
3540 #endif
3541 
3542 #endif // _GLIBCXX_USE_C99_MATH_TR1
3543 #endif // C++11
3544 
3545 #if __cplusplus >= 201703L
3546 
3547  // [c.math.hypot3], three-dimensional hypotenuse
3548 #define __cpp_lib_hypot 201603L
3549 
3550  template<typename _Tp>
3551  inline _Tp
3552  __hypot3(_Tp __x, _Tp __y, _Tp __z)
3553  {
3554  __x = std::abs(__x);
3555  __y = std::abs(__y);
3556  __z = std::abs(__z);
3557  if (_Tp __a = __x < __y ? __y < __z ? __z : __y : __x < __z ? __z : __x)
3558  return __a * std::sqrt((__x / __a) * (__x / __a)
3559  + (__y / __a) * (__y / __a)
3560  + (__z / __a) * (__z / __a));
3561  else
3562  return {};
3563  }
3564 
3565  inline float
3566  hypot(float __x, float __y, float __z)
3567  { return std::__hypot3<float>(__x, __y, __z); }
3568 
3569  inline double
3570  hypot(double __x, double __y, double __z)
3571  { return std::__hypot3<double>(__x, __y, __z); }
3572 
3573  inline long double
3574  hypot(long double __x, long double __y, long double __z)
3575  { return std::__hypot3<long double>(__x, __y, __z); }
3576 
3577  template<typename _Tp, typename _Up, typename _Vp>
3578  __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>
3579  hypot(_Tp __x, _Up __y, _Vp __z)
3580  {
3581  using __type = __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>;
3582  return std::__hypot3<__type>(__x, __y, __z);
3583  }
3584 
3585 #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3586  inline _Float16
3587  hypot(_Float16 __x, _Float16 __y, _Float16 __z)
3588  { return std::__hypot3<_Float16>(__x, __y, __z); }
3589 #endif
3590 
3591 #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3592  inline _Float32
3593  hypot(_Float32 __x, _Float32 __y, _Float32 __z)
3594  { return std::__hypot3<_Float32>(__x, __y, __z); }
3595 #endif
3596 
3597 #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
3598  inline _Float64
3599  hypot(_Float64 __x, _Float64 __y, _Float64 __z)
3600  { return std::__hypot3<_Float64>(__x, __y, __z); }
3601 #endif
3602 
3603 #if defined(__STDCPP_FLOAT128_T__) \
3604  && (defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) \
3605  || defined(_GLIBCXX_HAVE_FLOAT128_MATH))
3606  inline _Float128
3607  hypot(_Float128 __x, _Float128 __y, _Float128 __z)
3608  { return std::__hypot3<_Float128>(__x, __y, __z); }
3609 #endif
3610 
3611 #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3612  inline __gnu_cxx::__bfloat16_t
3613  hypot(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z)
3614  { return std::__hypot3<__gnu_cxx::__bfloat16_t>(__x, __y, __z); }
3615 #endif
3616 
3617 #endif // C++17
3618 
3619 #if __cplusplus >= 202002L
3620  // linear interpolation
3621 # define __cpp_lib_interpolate 201902L
3622 
3623  template<typename _Fp>
3624  constexpr _Fp
3625  __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept
3626  {
3627  if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
3628  return __t * __b + (1 - __t) * __a;
3629 
3630  if (__t == 1)
3631  return __b; // exact
3632 
3633  // Exact at __t=0, monotonic except near __t=1,
3634  // bounded, determinate, and consistent:
3635  const _Fp __x = __a + __t * (__b - __a);
3636  return (__t > 1) == (__b > __a)
3637  ? (__b < __x ? __x : __b)
3638  : (__b > __x ? __x : __b); // monotonic near __t=1
3639  }
3640 
3641  constexpr float
3642  lerp(float __a, float __b, float __t) noexcept
3643  { return std::__lerp(__a, __b, __t); }
3644 
3645  constexpr double
3646  lerp(double __a, double __b, double __t) noexcept
3647  { return std::__lerp(__a, __b, __t); }
3648 
3649  constexpr long double
3650  lerp(long double __a, long double __b, long double __t) noexcept
3651  { return std::__lerp(__a, __b, __t); }
3652 
3653  template<typename _Tp, typename _Up, typename _Vp>
3654  constexpr __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>
3655  lerp(_Tp __x, _Up __y, _Vp __z) noexcept
3656  {
3657  using __type = __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>;
3658  return std::__lerp<__type>(__x, __y, __z);
3659  }
3660 
3661 #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3662  inline _Float16
3663  lerp(_Float16 __x, _Float16 __y, _Float16 __z) noexcept
3664  { return std::__lerp<_Float16>(__x, __y, __z); }
3665 #endif
3666 
3667 #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3668  inline _Float32
3669  lerp(_Float32 __x, _Float32 __y, _Float32 __z) noexcept
3670  { return std::__lerp<_Float32>(__x, __y, __z); }
3671 #endif
3672 
3673 #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
3674  inline _Float64
3675  lerp(_Float64 __x, _Float64 __y, _Float64 __z) noexcept
3676  { return std::__lerp<_Float64>(__x, __y, __z); }
3677 #endif
3678 
3679 #if defined(__STDCPP_FLOAT128_T__) \
3680  && (defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) \
3681  || defined(_GLIBCXX_HAVE_FLOAT128_MATH))
3682  inline _Float128
3683  lerp(_Float128 __x, _Float128 __y, _Float128 __z) noexcept
3684  { return std::__lerp<_Float128>(__x, __y, __z); }
3685 #endif
3686 
3687 #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32)
3688  inline __gnu_cxx::__bfloat16_t
3689  lerp(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z) noexcept
3690  { return std::__lerp<__gnu_cxx::__bfloat16_t>(__x, __y, __z); }
3691 #endif
3692 
3693 #endif // C++20
3694 
3695 _GLIBCXX_END_NAMESPACE_VERSION
3696 } // namespace
3697 
3698 #if _GLIBCXX_USE_STD_SPEC_FUNCS
3699 # include <bits/specfun.h>
3700 #endif
3701 
3702 } // extern "C++"
3703 
3704 #endif