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