OLD | NEW |
| (Empty) |
1 // TR1 cmath -*- C++ -*- | |
2 | |
3 // Copyright (C) 2007, 2009 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 tr1_impl/cmath | |
26 * This is an internal header file, included by other library headers. | |
27 * You should not attempt to use it directly. | |
28 */ | |
29 | |
30 #if _GLIBCXX_USE_C99_MATH_TR1 | |
31 | |
32 #undef acosh | |
33 #undef acoshf | |
34 #undef acoshl | |
35 #undef asinh | |
36 #undef asinhf | |
37 #undef asinhl | |
38 #undef atanh | |
39 #undef atanhf | |
40 #undef atanhl | |
41 #undef cbrt | |
42 #undef cbrtf | |
43 #undef cbrtl | |
44 #undef copysign | |
45 #undef copysignf | |
46 #undef copysignl | |
47 #undef erf | |
48 #undef erff | |
49 #undef erfl | |
50 #undef erfc | |
51 #undef erfcf | |
52 #undef erfcl | |
53 #undef exp2 | |
54 #undef exp2f | |
55 #undef exp2l | |
56 #undef expm1 | |
57 #undef expm1f | |
58 #undef expm1l | |
59 #undef fdim | |
60 #undef fdimf | |
61 #undef fdiml | |
62 #undef fma | |
63 #undef fmaf | |
64 #undef fmal | |
65 #undef fmax | |
66 #undef fmaxf | |
67 #undef fmaxl | |
68 #undef fmin | |
69 #undef fminf | |
70 #undef fminl | |
71 #undef hypot | |
72 #undef hypotf | |
73 #undef hypotl | |
74 #undef ilogb | |
75 #undef ilogbf | |
76 #undef ilogbl | |
77 #undef lgamma | |
78 #undef lgammaf | |
79 #undef lgammal | |
80 #undef llrint | |
81 #undef llrintf | |
82 #undef llrintl | |
83 #undef llround | |
84 #undef llroundf | |
85 #undef llroundl | |
86 #undef log1p | |
87 #undef log1pf | |
88 #undef log1pl | |
89 #undef log2 | |
90 #undef log2f | |
91 #undef log2l | |
92 #undef logb | |
93 #undef logbf | |
94 #undef logbl | |
95 #undef lrint | |
96 #undef lrintf | |
97 #undef lrintl | |
98 #undef lround | |
99 #undef lroundf | |
100 #undef lroundl | |
101 #undef nan | |
102 #undef nanf | |
103 #undef nanl | |
104 #undef nearbyint | |
105 #undef nearbyintf | |
106 #undef nearbyintl | |
107 #undef nextafter | |
108 #undef nextafterf | |
109 #undef nextafterl | |
110 #undef nexttoward | |
111 #undef nexttowardf | |
112 #undef nexttowardl | |
113 #undef remainder | |
114 #undef remainderf | |
115 #undef remainderl | |
116 #undef remquo | |
117 #undef remquof | |
118 #undef remquol | |
119 #undef rint | |
120 #undef rintf | |
121 #undef rintl | |
122 #undef round | |
123 #undef roundf | |
124 #undef roundl | |
125 #undef scalbln | |
126 #undef scalblnf | |
127 #undef scalblnl | |
128 #undef scalbn | |
129 #undef scalbnf | |
130 #undef scalbnl | |
131 #undef tgamma | |
132 #undef tgammaf | |
133 #undef tgammal | |
134 #undef trunc | |
135 #undef truncf | |
136 #undef truncl | |
137 | |
138 #endif | |
139 | |
140 namespace std | |
141 { | |
142 _GLIBCXX_BEGIN_NAMESPACE_TR1 | |
143 | |
144 #if _GLIBCXX_USE_C99_MATH_TR1 | |
145 | |
146 // types | |
147 using ::double_t; | |
148 using ::float_t; | |
149 | |
150 // functions | |
151 using ::acosh; | |
152 using ::acoshf; | |
153 using ::acoshl; | |
154 | |
155 using ::asinh; | |
156 using ::asinhf; | |
157 using ::asinhl; | |
158 | |
159 using ::atanh; | |
160 using ::atanhf; | |
161 using ::atanhl; | |
162 | |
163 using ::cbrt; | |
164 using ::cbrtf; | |
165 using ::cbrtl; | |
166 | |
167 using ::copysign; | |
168 using ::copysignf; | |
169 using ::copysignl; | |
170 | |
171 using ::erf; | |
172 using ::erff; | |
173 using ::erfl; | |
174 | |
175 using ::erfc; | |
176 using ::erfcf; | |
177 using ::erfcl; | |
178 | |
179 using ::exp2; | |
180 using ::exp2f; | |
181 using ::exp2l; | |
182 | |
183 using ::expm1; | |
184 using ::expm1f; | |
185 using ::expm1l; | |
186 | |
187 using ::fdim; | |
188 using ::fdimf; | |
189 using ::fdiml; | |
190 | |
191 using ::fma; | |
192 using ::fmaf; | |
193 using ::fmal; | |
194 | |
195 using ::fmax; | |
196 using ::fmaxf; | |
197 using ::fmaxl; | |
198 | |
199 using ::fmin; | |
200 using ::fminf; | |
201 using ::fminl; | |
202 | |
203 using ::hypot; | |
204 using ::hypotf; | |
205 using ::hypotl; | |
206 | |
207 using ::ilogb; | |
208 using ::ilogbf; | |
209 using ::ilogbl; | |
210 | |
211 using ::lgamma; | |
212 using ::lgammaf; | |
213 using ::lgammal; | |
214 | |
215 using ::llrint; | |
216 using ::llrintf; | |
217 using ::llrintl; | |
218 | |
219 using ::llround; | |
220 using ::llroundf; | |
221 using ::llroundl; | |
222 | |
223 using ::log1p; | |
224 using ::log1pf; | |
225 using ::log1pl; | |
226 | |
227 using ::log2; | |
228 using ::log2f; | |
229 using ::log2l; | |
230 | |
231 using ::logb; | |
232 using ::logbf; | |
233 using ::logbl; | |
234 | |
235 using ::lrint; | |
236 using ::lrintf; | |
237 using ::lrintl; | |
238 | |
239 using ::lround; | |
240 using ::lroundf; | |
241 using ::lroundl; | |
242 | |
243 using ::nan; | |
244 using ::nanf; | |
245 using ::nanl; | |
246 | |
247 using ::nearbyint; | |
248 using ::nearbyintf; | |
249 using ::nearbyintl; | |
250 | |
251 using ::nextafter; | |
252 using ::nextafterf; | |
253 using ::nextafterl; | |
254 | |
255 using ::nexttoward; | |
256 using ::nexttowardf; | |
257 using ::nexttowardl; | |
258 | |
259 using ::remainder; | |
260 using ::remainderf; | |
261 using ::remainderl; | |
262 | |
263 using ::remquo; | |
264 using ::remquof; | |
265 using ::remquol; | |
266 | |
267 using ::rint; | |
268 using ::rintf; | |
269 using ::rintl; | |
270 | |
271 using ::round; | |
272 using ::roundf; | |
273 using ::roundl; | |
274 | |
275 using ::scalbln; | |
276 using ::scalblnf; | |
277 using ::scalblnl; | |
278 | |
279 using ::scalbn; | |
280 using ::scalbnf; | |
281 using ::scalbnl; | |
282 | |
283 using ::tgamma; | |
284 using ::tgammaf; | |
285 using ::tgammal; | |
286 | |
287 using ::trunc; | |
288 using ::truncf; | |
289 using ::truncl; | |
290 | |
291 #endif | |
292 | |
293 #if _GLIBCXX_USE_C99_MATH | |
294 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC | |
295 | |
296 /// Function template definitions [8.16.3]. | |
297 using std::signbit; | |
298 | |
299 using std::fpclassify; | |
300 | |
301 using std::isfinite; | |
302 using std::isinf; | |
303 using std::isnan; | |
304 using std::isnormal; | |
305 | |
306 using std::isgreater; | |
307 using std::isgreaterequal; | |
308 using std::isless; | |
309 using std::islessequal; | |
310 using std::islessgreater; | |
311 using std::isunordered; | |
312 #endif | |
313 #endif | |
314 | |
315 #if _GLIBCXX_USE_C99_MATH_TR1 | |
316 | |
317 /// Additional overloads [8.16.4]. | |
318 using std::acos; | |
319 | |
320 inline float | |
321 acosh(float __x) | |
322 { return __builtin_acoshf(__x); } | |
323 | |
324 inline long double | |
325 acosh(long double __x) | |
326 { return __builtin_acoshl(__x); } | |
327 | |
328 template<typename _Tp> | |
329 inline typename __gnu_cxx::__promote<_Tp>::__type | |
330 acosh(_Tp __x) | |
331 { | |
332 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
333 return acosh(__type(__x)); | |
334 } | |
335 | |
336 using std::asin; | |
337 | |
338 inline float | |
339 asinh(float __x) | |
340 { return __builtin_asinhf(__x); } | |
341 | |
342 inline long double | |
343 asinh(long double __x) | |
344 { return __builtin_asinhl(__x); } | |
345 | |
346 template<typename _Tp> | |
347 inline typename __gnu_cxx::__promote<_Tp>::__type | |
348 asinh(_Tp __x) | |
349 { | |
350 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
351 return asinh(__type(__x)); | |
352 } | |
353 | |
354 using std::atan; | |
355 using std::atan2; | |
356 | |
357 inline float | |
358 atanh(float __x) | |
359 { return __builtin_atanhf(__x); } | |
360 | |
361 inline long double | |
362 atanh(long double __x) | |
363 { return __builtin_atanhl(__x); } | |
364 | |
365 template<typename _Tp> | |
366 inline typename __gnu_cxx::__promote<_Tp>::__type | |
367 atanh(_Tp __x) | |
368 { | |
369 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
370 return atanh(__type(__x)); | |
371 } | |
372 | |
373 inline float | |
374 cbrt(float __x) | |
375 { return __builtin_cbrtf(__x); } | |
376 | |
377 inline long double | |
378 cbrt(long double __x) | |
379 { return __builtin_cbrtl(__x); } | |
380 | |
381 template<typename _Tp> | |
382 inline typename __gnu_cxx::__promote<_Tp>::__type | |
383 cbrt(_Tp __x) | |
384 { | |
385 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
386 return cbrt(__type(__x)); | |
387 } | |
388 | |
389 using std::ceil; | |
390 | |
391 inline float | |
392 copysign(float __x, float __y) | |
393 { return __builtin_copysignf(__x, __y); } | |
394 | |
395 inline long double | |
396 copysign(long double __x, long double __y) | |
397 { return __builtin_copysignl(__x, __y); } | |
398 | |
399 template<typename _Tp, typename _Up> | |
400 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
401 copysign(_Tp __x, _Up __y) | |
402 { | |
403 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
404 return copysign(__type(__x), __type(__y)); | |
405 } | |
406 | |
407 using std::cos; | |
408 using std::cosh; | |
409 | |
410 inline float | |
411 erf(float __x) | |
412 { return __builtin_erff(__x); } | |
413 | |
414 inline long double | |
415 erf(long double __x) | |
416 { return __builtin_erfl(__x); } | |
417 | |
418 template<typename _Tp> | |
419 inline typename __gnu_cxx::__promote<_Tp>::__type | |
420 erf(_Tp __x) | |
421 { | |
422 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
423 return erf(__type(__x)); | |
424 } | |
425 | |
426 inline float | |
427 erfc(float __x) | |
428 { return __builtin_erfcf(__x); } | |
429 | |
430 inline long double | |
431 erfc(long double __x) | |
432 { return __builtin_erfcl(__x); } | |
433 | |
434 template<typename _Tp> | |
435 inline typename __gnu_cxx::__promote<_Tp>::__type | |
436 erfc(_Tp __x) | |
437 { | |
438 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
439 return erfc(__type(__x)); | |
440 } | |
441 | |
442 using std::exp; | |
443 | |
444 inline float | |
445 exp2(float __x) | |
446 { return __builtin_exp2f(__x); } | |
447 | |
448 inline long double | |
449 exp2(long double __x) | |
450 { return __builtin_exp2l(__x); } | |
451 | |
452 template<typename _Tp> | |
453 inline typename __gnu_cxx::__promote<_Tp>::__type | |
454 exp2(_Tp __x) | |
455 { | |
456 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
457 return exp2(__type(__x)); | |
458 } | |
459 | |
460 inline float | |
461 expm1(float __x) | |
462 { return __builtin_expm1f(__x); } | |
463 | |
464 inline long double | |
465 expm1(long double __x) | |
466 { return __builtin_expm1l(__x); } | |
467 | |
468 template<typename _Tp> | |
469 inline typename __gnu_cxx::__promote<_Tp>::__type | |
470 expm1(_Tp __x) | |
471 { | |
472 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
473 return expm1(__type(__x)); | |
474 } | |
475 | |
476 using std::fabs; | |
477 | |
478 inline float | |
479 fdim(float __x, float __y) | |
480 { return __builtin_fdimf(__x, __y); } | |
481 | |
482 inline long double | |
483 fdim(long double __x, long double __y) | |
484 { return __builtin_fdiml(__x, __y); } | |
485 | |
486 template<typename _Tp, typename _Up> | |
487 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
488 fdim(_Tp __x, _Up __y) | |
489 { | |
490 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
491 return fdim(__type(__x), __type(__y)); | |
492 } | |
493 | |
494 using std::floor; | |
495 | |
496 inline float | |
497 fma(float __x, float __y, float __z) | |
498 { return __builtin_fmaf(__x, __y, __z); } | |
499 | |
500 inline long double | |
501 fma(long double __x, long double __y, long double __z) | |
502 { return __builtin_fmal(__x, __y, __z); } | |
503 | |
504 template<typename _Tp, typename _Up, typename _Vp> | |
505 inline typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type | |
506 fma(_Tp __x, _Up __y, _Vp __z) | |
507 { | |
508 typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; | |
509 return fma(__type(__x), __type(__y), __type(__z)); | |
510 } | |
511 | |
512 inline float | |
513 fmax(float __x, float __y) | |
514 { return __builtin_fmaxf(__x, __y); } | |
515 | |
516 inline long double | |
517 fmax(long double __x, long double __y) | |
518 { return __builtin_fmaxl(__x, __y); } | |
519 | |
520 template<typename _Tp, typename _Up> | |
521 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
522 fmax(_Tp __x, _Up __y) | |
523 { | |
524 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
525 return fmax(__type(__x), __type(__y)); | |
526 } | |
527 | |
528 inline float | |
529 fmin(float __x, float __y) | |
530 { return __builtin_fminf(__x, __y); } | |
531 | |
532 inline long double | |
533 fmin(long double __x, long double __y) | |
534 { return __builtin_fminl(__x, __y); } | |
535 | |
536 template<typename _Tp, typename _Up> | |
537 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
538 fmin(_Tp __x, _Up __y) | |
539 { | |
540 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
541 return fmin(__type(__x), __type(__y)); | |
542 } | |
543 | |
544 using std::fmod; | |
545 using std::frexp; | |
546 | |
547 inline float | |
548 hypot(float __x, float __y) | |
549 { return __builtin_hypotf(__x, __y); } | |
550 | |
551 inline long double | |
552 hypot(long double __x, long double __y) | |
553 { return __builtin_hypotl(__x, __y); } | |
554 | |
555 template<typename _Tp, typename _Up> | |
556 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
557 hypot(_Tp __x, _Up __y) | |
558 { | |
559 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
560 return hypot(__type(__x), __type(__y)); | |
561 } | |
562 | |
563 inline int | |
564 ilogb(float __x) | |
565 { return __builtin_ilogbf(__x); } | |
566 | |
567 inline int | |
568 ilogb(long double __x) | |
569 { return __builtin_ilogbl(__x); } | |
570 | |
571 template<typename _Tp> | |
572 inline int | |
573 ilogb(_Tp __x) | |
574 { | |
575 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
576 return ilogb(__type(__x)); | |
577 } | |
578 | |
579 using std::ldexp; | |
580 | |
581 inline float | |
582 lgamma(float __x) | |
583 { return __builtin_lgammaf(__x); } | |
584 | |
585 inline long double | |
586 lgamma(long double __x) | |
587 { return __builtin_lgammal(__x); } | |
588 | |
589 template<typename _Tp> | |
590 inline typename __gnu_cxx::__promote<_Tp>::__type | |
591 lgamma(_Tp __x) | |
592 { | |
593 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
594 return lgamma(__type(__x)); | |
595 } | |
596 | |
597 inline long long | |
598 llrint(float __x) | |
599 { return __builtin_llrintf(__x); } | |
600 | |
601 inline long long | |
602 llrint(long double __x) | |
603 { return __builtin_llrintl(__x); } | |
604 | |
605 template<typename _Tp> | |
606 inline long long | |
607 llrint(_Tp __x) | |
608 { | |
609 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
610 return llrint(__type(__x)); | |
611 } | |
612 | |
613 inline long long | |
614 llround(float __x) | |
615 { return __builtin_llroundf(__x); } | |
616 | |
617 inline long long | |
618 llround(long double __x) | |
619 { return __builtin_llroundl(__x); } | |
620 | |
621 template<typename _Tp> | |
622 inline long long | |
623 llround(_Tp __x) | |
624 { | |
625 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
626 return llround(__type(__x)); | |
627 } | |
628 | |
629 using std::log; | |
630 using std::log10; | |
631 | |
632 inline float | |
633 log1p(float __x) | |
634 { return __builtin_log1pf(__x); } | |
635 | |
636 inline long double | |
637 log1p(long double __x) | |
638 { return __builtin_log1pl(__x); } | |
639 | |
640 template<typename _Tp> | |
641 inline typename __gnu_cxx::__promote<_Tp>::__type | |
642 log1p(_Tp __x) | |
643 { | |
644 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
645 return log1p(__type(__x)); | |
646 } | |
647 | |
648 // DR 568. | |
649 inline float | |
650 log2(float __x) | |
651 { return __builtin_log2f(__x); } | |
652 | |
653 inline long double | |
654 log2(long double __x) | |
655 { return __builtin_log2l(__x); } | |
656 | |
657 template<typename _Tp> | |
658 inline typename __gnu_cxx::__promote<_Tp>::__type | |
659 log2(_Tp __x) | |
660 { | |
661 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
662 return log2(__type(__x)); | |
663 } | |
664 | |
665 inline float | |
666 logb(float __x) | |
667 { return __builtin_logbf(__x); } | |
668 | |
669 inline long double | |
670 logb(long double __x) | |
671 { return __builtin_logbl(__x); } | |
672 | |
673 template<typename _Tp> | |
674 inline typename __gnu_cxx::__promote<_Tp>::__type | |
675 logb(_Tp __x) | |
676 { | |
677 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
678 return logb(__type(__x)); | |
679 } | |
680 | |
681 inline long | |
682 lrint(float __x) | |
683 { return __builtin_lrintf(__x); } | |
684 | |
685 inline long | |
686 lrint(long double __x) | |
687 { return __builtin_lrintl(__x); } | |
688 | |
689 template<typename _Tp> | |
690 inline long | |
691 lrint(_Tp __x) | |
692 { | |
693 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
694 return lrint(__type(__x)); | |
695 } | |
696 | |
697 inline long | |
698 lround(float __x) | |
699 { return __builtin_lroundf(__x); } | |
700 | |
701 inline long | |
702 lround(long double __x) | |
703 { return __builtin_lroundl(__x); } | |
704 | |
705 template<typename _Tp> | |
706 inline long | |
707 lround(_Tp __x) | |
708 { | |
709 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
710 return lround(__type(__x)); | |
711 } | |
712 | |
713 inline float | |
714 nearbyint(float __x) | |
715 { return __builtin_nearbyintf(__x); } | |
716 | |
717 inline long double | |
718 nearbyint(long double __x) | |
719 { return __builtin_nearbyintl(__x); } | |
720 | |
721 template<typename _Tp> | |
722 inline typename __gnu_cxx::__promote<_Tp>::__type | |
723 nearbyint(_Tp __x) | |
724 { | |
725 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
726 return nearbyint(__type(__x)); | |
727 } | |
728 | |
729 inline float | |
730 nextafter(float __x, float __y) | |
731 { return __builtin_nextafterf(__x, __y); } | |
732 | |
733 inline long double | |
734 nextafter(long double __x, long double __y) | |
735 { return __builtin_nextafterl(__x, __y); } | |
736 | |
737 template<typename _Tp, typename _Up> | |
738 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
739 nextafter(_Tp __x, _Up __y) | |
740 { | |
741 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
742 return nextafter(__type(__x), __type(__y)); | |
743 } | |
744 | |
745 inline float | |
746 nexttoward(float __x, long double __y) | |
747 { return __builtin_nexttowardf(__x, __y); } | |
748 | |
749 inline long double | |
750 nexttoward(long double __x, long double __y) | |
751 { return __builtin_nexttowardl(__x, __y); } | |
752 | |
753 template<typename _Tp> | |
754 inline typename __gnu_cxx::__promote<_Tp>::__type | |
755 nexttoward(_Tp __x, long double __y) | |
756 { | |
757 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
758 return nexttoward(__type(__x), __y); | |
759 } | |
760 | |
761 // DR 550. What should the return type of pow(float,int) be? | |
762 // NB: C++0x and TR1 != C++03. | |
763 // using std::pow; | |
764 | |
765 inline float | |
766 remainder(float __x, float __y) | |
767 { return __builtin_remainderf(__x, __y); } | |
768 | |
769 inline long double | |
770 remainder(long double __x, long double __y) | |
771 { return __builtin_remainderl(__x, __y); } | |
772 | |
773 template<typename _Tp, typename _Up> | |
774 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
775 remainder(_Tp __x, _Up __y) | |
776 { | |
777 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
778 return remainder(__type(__x), __type(__y)); | |
779 } | |
780 | |
781 inline float | |
782 remquo(float __x, float __y, int* __pquo) | |
783 { return __builtin_remquof(__x, __y, __pquo); } | |
784 | |
785 inline long double | |
786 remquo(long double __x, long double __y, int* __pquo) | |
787 { return __builtin_remquol(__x, __y, __pquo); } | |
788 | |
789 template<typename _Tp, typename _Up> | |
790 inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
791 remquo(_Tp __x, _Up __y, int* __pquo) | |
792 { | |
793 typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
794 return remquo(__type(__x), __type(__y), __pquo); | |
795 } | |
796 | |
797 inline float | |
798 rint(float __x) | |
799 { return __builtin_rintf(__x); } | |
800 | |
801 inline long double | |
802 rint(long double __x) | |
803 { return __builtin_rintl(__x); } | |
804 | |
805 template<typename _Tp> | |
806 inline typename __gnu_cxx::__promote<_Tp>::__type | |
807 rint(_Tp __x) | |
808 { | |
809 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
810 return rint(__type(__x)); | |
811 } | |
812 | |
813 inline float | |
814 round(float __x) | |
815 { return __builtin_roundf(__x); } | |
816 | |
817 inline long double | |
818 round(long double __x) | |
819 { return __builtin_roundl(__x); } | |
820 | |
821 template<typename _Tp> | |
822 inline typename __gnu_cxx::__promote<_Tp>::__type | |
823 round(_Tp __x) | |
824 { | |
825 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
826 return round(__type(__x)); | |
827 } | |
828 | |
829 inline float | |
830 scalbln(float __x, long __ex) | |
831 { return __builtin_scalblnf(__x, __ex); } | |
832 | |
833 inline long double | |
834 scalbln(long double __x, long __ex) | |
835 { return __builtin_scalblnl(__x, __ex); } | |
836 | |
837 template<typename _Tp> | |
838 inline typename __gnu_cxx::__promote<_Tp>::__type | |
839 scalbln(_Tp __x, long __ex) | |
840 { | |
841 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
842 return scalbln(__type(__x), __ex); | |
843 } | |
844 | |
845 inline float | |
846 scalbn(float __x, int __ex) | |
847 { return __builtin_scalbnf(__x, __ex); } | |
848 | |
849 inline long double | |
850 scalbn(long double __x, int __ex) | |
851 { return __builtin_scalbnl(__x, __ex); } | |
852 | |
853 template<typename _Tp> | |
854 inline typename __gnu_cxx::__promote<_Tp>::__type | |
855 scalbn(_Tp __x, int __ex) | |
856 { | |
857 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
858 return scalbn(__type(__x), __ex); | |
859 } | |
860 | |
861 using std::sin; | |
862 using std::sinh; | |
863 using std::sqrt; | |
864 using std::tan; | |
865 using std::tanh; | |
866 | |
867 inline float | |
868 tgamma(float __x) | |
869 { return __builtin_tgammaf(__x); } | |
870 | |
871 inline long double | |
872 tgamma(long double __x) | |
873 { return __builtin_tgammal(__x); } | |
874 | |
875 template<typename _Tp> | |
876 inline typename __gnu_cxx::__promote<_Tp>::__type | |
877 tgamma(_Tp __x) | |
878 { | |
879 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
880 return tgamma(__type(__x)); | |
881 } | |
882 | |
883 inline float | |
884 trunc(float __x) | |
885 { return __builtin_truncf(__x); } | |
886 | |
887 inline long double | |
888 trunc(long double __x) | |
889 { return __builtin_truncl(__x); } | |
890 | |
891 template<typename _Tp> | |
892 inline typename __gnu_cxx::__promote<_Tp>::__type | |
893 trunc(_Tp __x) | |
894 { | |
895 typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
896 return trunc(__type(__x)); | |
897 } | |
898 | |
899 #endif | |
900 | |
901 _GLIBCXX_END_NAMESPACE_TR1 | |
902 } | |
OLD | NEW |