]>
Commit | Line | Data |
---|---|---|
34ff0b99 | 1 | // -*- C++ -*- C forwarding header. |
22aef514 | 2 | |
0e7edcd5 PC |
3 | // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
4 | // 2006, 2007 | |
34ff0b99 | 5 | // Free Software Foundation, Inc. |
22aef514 BK |
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 2, 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 | // You should have received a copy of the GNU General Public License along | |
19 | // with this library; see the file COPYING. If not, write to the Free | |
83f51799 | 20 | // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
22aef514 BK |
21 | // USA. |
22 | ||
23 | // As a special exception, you may use this file as part of a free software | |
24 | // library without restriction. Specifically, if other files instantiate | |
25 | // templates or use macros or inline functions from this file, or you compile | |
26 | // this file and link it with other files to produce an executable, this | |
27 | // file does not by itself cause the resulting executable to be covered by | |
28 | // the GNU General Public License. This exception does not however | |
29 | // invalidate any other reasons why the executable file might be covered by | |
30 | // the GNU General Public License. | |
31 | ||
143c27b0 | 32 | /** @file include/cmath |
ffe94f83 PE |
33 | * This is a Standard C++ Library file. You should @c #include this file |
34 | * in your programs, rather than any of the "*.h" implementation files. | |
35 | * | |
36 | * This is the C++ version of the Standard C Library header @c math.h, | |
37 | * and its contents are (mostly) the same as that header, but are all | |
097588e4 PC |
38 | * contained in the namespace @c std (except for names which are defined |
39 | * as macros in C). | |
ffe94f83 PE |
40 | */ |
41 | ||
143c27b0 BK |
42 | // |
43 | // ISO C++ 14882: 26.5 C library | |
44 | // | |
45 | ||
1143680e SE |
46 | #ifndef _GLIBCXX_CMATH |
47 | #define _GLIBCXX_CMATH 1 | |
34ff0b99 BK |
48 | |
49 | #pragma GCC system_header | |
22aef514 | 50 | |
98e6e789 | 51 | #include <bits/c++config.h> |
cdc958d8 | 52 | #include <bits/cpp_type_traits.h> |
105c6331 | 53 | #include <ext/type_traits.h> |
4e588ec9 | 54 | |
c0dae541 | 55 | #include <math.h> |
22aef514 | 56 | |
8089616e BK |
57 | // Get rid of those macros defined in <math.h> in lieu of real functions. |
58 | #undef abs | |
59 | #undef div | |
60 | #undef acos | |
61 | #undef asin | |
62 | #undef atan | |
63 | #undef atan2 | |
64 | #undef ceil | |
65 | #undef cos | |
66 | #undef cosh | |
67 | #undef exp | |
68 | #undef fabs | |
69 | #undef floor | |
70 | #undef fmod | |
71 | #undef frexp | |
72 | #undef ldexp | |
73 | #undef log | |
74 | #undef log10 | |
75 | #undef modf | |
76 | #undef pow | |
77 | #undef sin | |
78 | #undef sinh | |
4200d6fe | 79 | #undef sqrt |
8089616e BK |
80 | #undef tan |
81 | #undef tanh | |
82 | ||
3cbc7af0 | 83 | _GLIBCXX_BEGIN_NAMESPACE(std) |
b39d0359 | 84 | |
98e6e789 BK |
85 | // Forward declaration of a helper function. This really should be |
86 | // an `exported' forward declaration. | |
87 | template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int); | |
88 | ||
4e588ec9 GDR |
89 | inline double |
90 | abs(double __x) | |
91 | { return __builtin_fabs(__x); } | |
92 | ||
d52e4867 RS |
93 | inline float |
94 | abs(float __x) | |
95 | { return __builtin_fabsf(__x); } | |
96 | ||
4e588ec9 GDR |
97 | inline long double |
98 | abs(long double __x) | |
99 | { return __builtin_fabsl(__x); } | |
100 | ||
de96ac46 | 101 | using ::acos; |
c85dfef7 RS |
102 | |
103 | inline float | |
104 | acos(float __x) | |
105 | { return __builtin_acosf(__x); } | |
106 | ||
107 | inline long double | |
108 | acos(long double __x) | |
109 | { return __builtin_acosl(__x); } | |
4e588ec9 | 110 | |
cdc958d8 | 111 | template<typename _Tp> |
105c6331 BK |
112 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
113 | double>::__type | |
cdc958d8 | 114 | acos(_Tp __x) |
105c6331 | 115 | { return __builtin_acos(__x); } |
7dd8177f | 116 | |
d52e4867 RS |
117 | using ::asin; |
118 | ||
7dd8177f | 119 | inline float |
c85dfef7 RS |
120 | asin(float __x) |
121 | { return __builtin_asinf(__x); } | |
22aef514 | 122 | |
7dd8177f | 123 | inline long double |
c85dfef7 RS |
124 | asin(long double __x) |
125 | { return __builtin_asinl(__x); } | |
4e588ec9 | 126 | |
cdc958d8 | 127 | template<typename _Tp> |
105c6331 BK |
128 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
129 | double>::__type | |
cdc958d8 | 130 | asin(_Tp __x) |
c85dfef7 | 131 | { return __builtin_asin(__x); } |
cdc958d8 | 132 | |
d52e4867 RS |
133 | using ::atan; |
134 | ||
7dd8177f | 135 | inline float |
c85dfef7 RS |
136 | atan(float __x) |
137 | { return __builtin_atanf(__x); } | |
22aef514 | 138 | |
7dd8177f | 139 | inline long double |
c85dfef7 RS |
140 | atan(long double __x) |
141 | { return __builtin_atanl(__x); } | |
4e588ec9 | 142 | |
cdc958d8 | 143 | template<typename _Tp> |
105c6331 BK |
144 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
145 | double>::__type | |
cdc958d8 | 146 | atan(_Tp __x) |
c85dfef7 | 147 | { return __builtin_atan(__x); } |
7dd8177f | 148 | |
d52e4867 RS |
149 | using ::atan2; |
150 | ||
7dd8177f | 151 | inline float |
98e6e789 | 152 | atan2(float __y, float __x) |
c85dfef7 | 153 | { return __builtin_atan2f(__y, __x); } |
22aef514 | 154 | |
7dd8177f | 155 | inline long double |
c85dfef7 RS |
156 | atan2(long double __y, long double __x) |
157 | { return __builtin_atan2l(__y, __x); } | |
4e588ec9 | 158 | |
cdc958d8 | 159 | template<typename _Tp, typename _Up> |
105c6331 BK |
160 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value |
161 | && __is_integer<_Up>::__value, | |
162 | double>::__type | |
c85dfef7 RS |
163 | atan2(_Tp __y, _Up __x) |
164 | { return __builtin_atan2(__y, __x); } | |
cdc958d8 | 165 | |
d52e4867 RS |
166 | using ::ceil; |
167 | ||
7dd8177f | 168 | inline float |
c85dfef7 RS |
169 | ceil(float __x) |
170 | { return __builtin_ceilf(__x); } | |
22aef514 | 171 | |
7dd8177f | 172 | inline long double |
c85dfef7 RS |
173 | ceil(long double __x) |
174 | { return __builtin_ceill(__x); } | |
22aef514 | 175 | |
cdc958d8 | 176 | template<typename _Tp> |
105c6331 BK |
177 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
178 | double>::__type | |
cdc958d8 | 179 | ceil(_Tp __x) |
c85dfef7 | 180 | { return __builtin_ceil(__x); } |
7dd8177f | 181 | |
d52e4867 RS |
182 | using ::cos; |
183 | ||
4e588ec9 GDR |
184 | inline float |
185 | cos(float __x) | |
186 | { return __builtin_cosf(__x); } | |
187 | ||
4e588ec9 GDR |
188 | inline long double |
189 | cos(long double __x) | |
190 | { return __builtin_cosl(__x); } | |
191 | ||
cdc958d8 | 192 | template<typename _Tp> |
105c6331 BK |
193 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
194 | double>::__type | |
cdc958d8 GDR |
195 | cos(_Tp __x) |
196 | { return __builtin_cos(__x); } | |
197 | ||
d52e4867 RS |
198 | using ::cosh; |
199 | ||
7dd8177f | 200 | inline float |
c85dfef7 RS |
201 | cosh(float __x) |
202 | { return __builtin_coshf(__x); } | |
22aef514 | 203 | |
7dd8177f | 204 | inline long double |
c85dfef7 RS |
205 | cosh(long double __x) |
206 | { return __builtin_coshl(__x); } | |
4e588ec9 | 207 | |
cdc958d8 | 208 | template<typename _Tp> |
105c6331 BK |
209 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
210 | double>::__type | |
cdc958d8 | 211 | cosh(_Tp __x) |
c85dfef7 | 212 | { return __builtin_cosh(__x); } |
cdc958d8 | 213 | |
d52e4867 RS |
214 | using ::exp; |
215 | ||
7dd8177f | 216 | inline float |
c85dfef7 RS |
217 | exp(float __x) |
218 | { return __builtin_expf(__x); } | |
22aef514 | 219 | |
7dd8177f | 220 | inline long double |
c85dfef7 RS |
221 | exp(long double __x) |
222 | { return __builtin_expl(__x); } | |
22aef514 | 223 | |
cdc958d8 | 224 | template<typename _Tp> |
105c6331 BK |
225 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
226 | double>::__type | |
cdc958d8 | 227 | exp(_Tp __x) |
c85dfef7 | 228 | { return __builtin_exp(__x); } |
7dd8177f | 229 | |
d52e4867 RS |
230 | using ::fabs; |
231 | ||
4e588ec9 GDR |
232 | inline float |
233 | fabs(float __x) | |
234 | { return __builtin_fabsf(__x); } | |
235 | ||
4e588ec9 GDR |
236 | inline long double |
237 | fabs(long double __x) | |
238 | { return __builtin_fabsl(__x); } | |
239 | ||
cdc958d8 | 240 | template<typename _Tp> |
105c6331 BK |
241 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
242 | double>::__type | |
cdc958d8 GDR |
243 | fabs(_Tp __x) |
244 | { return __builtin_fabs(__x); } | |
245 | ||
d52e4867 RS |
246 | using ::floor; |
247 | ||
7dd8177f | 248 | inline float |
c85dfef7 RS |
249 | floor(float __x) |
250 | { return __builtin_floorf(__x); } | |
22aef514 | 251 | |
7dd8177f | 252 | inline long double |
c85dfef7 RS |
253 | floor(long double __x) |
254 | { return __builtin_floorl(__x); } | |
4e588ec9 | 255 | |
cdc958d8 | 256 | template<typename _Tp> |
105c6331 BK |
257 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
258 | double>::__type | |
cdc958d8 | 259 | floor(_Tp __x) |
c85dfef7 | 260 | { return __builtin_floor(__x); } |
7dd8177f | 261 | |
d52e4867 RS |
262 | using ::fmod; |
263 | ||
7dd8177f | 264 | inline float |
98e6e789 | 265 | fmod(float __x, float __y) |
c85dfef7 | 266 | { return __builtin_fmodf(__x, __y); } |
22aef514 | 267 | |
7dd8177f | 268 | inline long double |
c85dfef7 RS |
269 | fmod(long double __x, long double __y) |
270 | { return __builtin_fmodl(__x, __y); } | |
4e588ec9 | 271 | |
d52e4867 RS |
272 | using ::frexp; |
273 | ||
7dd8177f | 274 | inline float |
c85dfef7 RS |
275 | frexp(float __x, int* __exp) |
276 | { return __builtin_frexpf(__x, __exp); } | |
22aef514 | 277 | |
7dd8177f | 278 | inline long double |
c85dfef7 RS |
279 | frexp(long double __x, int* __exp) |
280 | { return __builtin_frexpl(__x, __exp); } | |
4e588ec9 | 281 | |
cdc958d8 | 282 | template<typename _Tp> |
105c6331 BK |
283 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
284 | double>::__type | |
cdc958d8 | 285 | frexp(_Tp __x, int* __exp) |
c85dfef7 | 286 | { return __builtin_frexp(__x, __exp); } |
7dd8177f | 287 | |
d52e4867 RS |
288 | using ::ldexp; |
289 | ||
7dd8177f | 290 | inline float |
98e6e789 | 291 | ldexp(float __x, int __exp) |
c85dfef7 | 292 | { return __builtin_ldexpf(__x, __exp); } |
22aef514 | 293 | |
7dd8177f | 294 | inline long double |
c85dfef7 RS |
295 | ldexp(long double __x, int __exp) |
296 | { return __builtin_ldexpl(__x, __exp); } | |
4e588ec9 | 297 | |
cdc958d8 | 298 | template<typename _Tp> |
105c6331 BK |
299 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
300 | double>::__type | |
cdc958d8 | 301 | ldexp(_Tp __x, int __exp) |
c85dfef7 | 302 | { return __builtin_ldexp(__x, __exp); } |
cdc958d8 | 303 | |
d52e4867 RS |
304 | using ::log; |
305 | ||
7dd8177f | 306 | inline float |
c85dfef7 RS |
307 | log(float __x) |
308 | { return __builtin_logf(__x); } | |
22aef514 | 309 | |
7dd8177f | 310 | inline long double |
c85dfef7 RS |
311 | log(long double __x) |
312 | { return __builtin_logl(__x); } | |
4e588ec9 | 313 | |
cdc958d8 | 314 | template<typename _Tp> |
105c6331 BK |
315 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
316 | double>::__type | |
cdc958d8 | 317 | log(_Tp __x) |
c85dfef7 | 318 | { return __builtin_log(__x); } |
7dd8177f | 319 | |
d52e4867 RS |
320 | using ::log10; |
321 | ||
7dd8177f | 322 | inline float |
c85dfef7 RS |
323 | log10(float __x) |
324 | { return __builtin_log10f(__x); } | |
22aef514 | 325 | |
7dd8177f | 326 | inline long double |
c85dfef7 RS |
327 | log10(long double __x) |
328 | { return __builtin_log10l(__x); } | |
4e588ec9 | 329 | |
cdc958d8 | 330 | template<typename _Tp> |
105c6331 BK |
331 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
332 | double>::__type | |
cdc958d8 | 333 | log10(_Tp __x) |
c85dfef7 | 334 | { return __builtin_log10(__x); } |
7dd8177f | 335 | |
d52e4867 RS |
336 | using ::modf; |
337 | ||
7dd8177f | 338 | inline float |
98e6e789 | 339 | modf(float __x, float* __iptr) |
c85dfef7 RS |
340 | { return __builtin_modff(__x, __iptr); } |
341 | ||
7dd8177f | 342 | inline long double |
c85dfef7 RS |
343 | modf(long double __x, long double* __iptr) |
344 | { return __builtin_modfl(__x, __iptr); } | |
4e588ec9 | 345 | |
98e6e789 BK |
346 | template<typename _Tp> |
347 | inline _Tp | |
348 | __pow_helper(_Tp __x, int __n) | |
349 | { | |
350 | return __n < 0 | |
351 | ? _Tp(1)/__cmath_power(__x, -__n) | |
352 | : __cmath_power(__x, __n); | |
353 | } | |
d52e4867 RS |
354 | |
355 | using ::pow; | |
356 | ||
7dd8177f | 357 | inline float |
98e6e789 | 358 | pow(float __x, float __y) |
c85dfef7 | 359 | { return __builtin_powf(__x, __y); } |
22aef514 | 360 | |
7dd8177f | 361 | inline long double |
c85dfef7 RS |
362 | pow(long double __x, long double __y) |
363 | { return __builtin_powl(__x, __y); } | |
22aef514 | 364 | |
7dd8177f | 365 | inline double |
98e6e789 | 366 | pow(double __x, int __i) |
ae63a1cc | 367 | { return __builtin_powi(__x, __i); } |
22aef514 | 368 | |
7dd8177f | 369 | inline float |
d52e4867 | 370 | pow(float __x, int __n) |
ae63a1cc | 371 | { return __builtin_powif(__x, __n); } |
d52e4867 | 372 | |
7dd8177f | 373 | inline long double |
4e588ec9 | 374 | pow(long double __x, int __n) |
ae63a1cc | 375 | { return __builtin_powil(__x, __n); } |
22aef514 | 376 | |
d52e4867 RS |
377 | using ::sin; |
378 | ||
4e588ec9 GDR |
379 | inline float |
380 | sin(float __x) | |
381 | { return __builtin_sinf(__x); } | |
22aef514 | 382 | |
4e588ec9 GDR |
383 | inline long double |
384 | sin(long double __x) | |
385 | { return __builtin_sinl(__x); } | |
22aef514 | 386 | |
cdc958d8 | 387 | template<typename _Tp> |
105c6331 BK |
388 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
389 | double>::__type | |
cdc958d8 GDR |
390 | sin(_Tp __x) |
391 | { return __builtin_sin(__x); } | |
392 | ||
d52e4867 RS |
393 | using ::sinh; |
394 | ||
7dd8177f | 395 | inline float |
c85dfef7 RS |
396 | sinh(float __x) |
397 | { return __builtin_sinhf(__x); } | |
22aef514 | 398 | |
7dd8177f | 399 | inline long double |
c85dfef7 RS |
400 | sinh(long double __x) |
401 | { return __builtin_sinhl(__x); } | |
22aef514 | 402 | |
cdc958d8 | 403 | template<typename _Tp> |
105c6331 BK |
404 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
405 | double>::__type | |
cdc958d8 | 406 | sinh(_Tp __x) |
c85dfef7 | 407 | { return __builtin_sinh(__x); } |
7dd8177f | 408 | |
d52e4867 RS |
409 | using ::sqrt; |
410 | ||
4e588ec9 GDR |
411 | inline float |
412 | sqrt(float __x) | |
413 | { return __builtin_sqrtf(__x); } | |
22aef514 | 414 | |
4e588ec9 GDR |
415 | inline long double |
416 | sqrt(long double __x) | |
417 | { return __builtin_sqrtl(__x); } | |
22aef514 | 418 | |
cdc958d8 | 419 | template<typename _Tp> |
105c6331 BK |
420 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
421 | double>::__type | |
cdc958d8 GDR |
422 | sqrt(_Tp __x) |
423 | { return __builtin_sqrt(__x); } | |
7dd8177f | 424 | |
d52e4867 RS |
425 | using ::tan; |
426 | ||
7dd8177f | 427 | inline float |
c85dfef7 RS |
428 | tan(float __x) |
429 | { return __builtin_tanf(__x); } | |
22aef514 | 430 | |
7dd8177f | 431 | inline long double |
c85dfef7 RS |
432 | tan(long double __x) |
433 | { return __builtin_tanl(__x); } | |
22aef514 | 434 | |
cdc958d8 | 435 | template<typename _Tp> |
105c6331 BK |
436 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
437 | double>::__type | |
cdc958d8 | 438 | tan(_Tp __x) |
c85dfef7 | 439 | { return __builtin_tan(__x); } |
7dd8177f | 440 | |
d52e4867 RS |
441 | using ::tanh; |
442 | ||
7dd8177f | 443 | inline float |
c85dfef7 RS |
444 | tanh(float __x) |
445 | { return __builtin_tanhf(__x); } | |
22aef514 | 446 | |
7dd8177f | 447 | inline long double |
c85dfef7 RS |
448 | tanh(long double __x) |
449 | { return __builtin_tanhl(__x); } | |
cdc958d8 GDR |
450 | |
451 | template<typename _Tp> | |
105c6331 BK |
452 | inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
453 | double>::__type | |
cdc958d8 | 454 | tanh(_Tp __x) |
c85dfef7 | 455 | { return __builtin_tanh(__x); } |
3cbc7af0 BK |
456 | |
457 | _GLIBCXX_END_NAMESPACE | |
22aef514 | 458 | |
517da0ce | 459 | #if _GLIBCXX_USE_C99_MATH |
3d7c150e | 460 | #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC |
7cda84dc | 461 | // These are possible macros imported from C99-land. For strict |
3702c634 | 462 | // conformance, remove possible C99-injected names from the global |
7dd8177f | 463 | // namespace, and sequester them in the __gnu_cxx extension namespace. |
3cbc7af0 BK |
464 | |
465 | _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) | |
466 | ||
7cda84dc | 467 | template<typename _Tp> |
d42a11e1 | 468 | inline int |
7cda84dc BK |
469 | __capture_fpclassify(_Tp __f) { return fpclassify(__f); } |
470 | ||
3cbc7af0 | 471 | _GLIBCXX_END_NAMESPACE |
7cda84dc | 472 | |
c04ec67e | 473 | // Only undefine the C99 FP macros, if actually captured for namespace movement |
7cda84dc BK |
474 | #undef fpclassify |
475 | #undef isfinite | |
476 | #undef isinf | |
477 | #undef isnan | |
478 | #undef isnormal | |
479 | #undef signbit | |
480 | #undef isgreater | |
481 | #undef isgreaterequal | |
482 | #undef isless | |
483 | #undef islessequal | |
484 | #undef islessgreater | |
485 | #undef isunordered | |
486 | ||
3cbc7af0 BK |
487 | _GLIBCXX_BEGIN_NAMESPACE(std) |
488 | ||
7cda84dc | 489 | template<typename _Tp> |
0e7edcd5 PC |
490 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
491 | int>::__type | |
492 | fpclassify(_Tp __f) | |
493 | { | |
494 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
495 | return ::__gnu_cxx::__capture_fpclassify(__type(__f)); | |
496 | } | |
7cda84dc BK |
497 | |
498 | template<typename _Tp> | |
0e7edcd5 PC |
499 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
500 | int>::__type | |
501 | isfinite(_Tp __f) | |
502 | { | |
503 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
504 | return __builtin_isfinite(__type(__f)); | |
505 | } | |
7cda84dc BK |
506 | |
507 | template<typename _Tp> | |
0e7edcd5 PC |
508 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
509 | int>::__type | |
510 | isinf(_Tp __f) | |
511 | { | |
512 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
513 | return __builtin_isinf(__type(__f)); | |
514 | } | |
7cda84dc BK |
515 | |
516 | template<typename _Tp> | |
0e7edcd5 PC |
517 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
518 | int>::__type | |
519 | isnan(_Tp __f) | |
520 | { | |
521 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
522 | return __builtin_isnan(__type(__f)); | |
523 | } | |
7cda84dc BK |
524 | |
525 | template<typename _Tp> | |
0e7edcd5 PC |
526 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
527 | int>::__type | |
528 | isnormal(_Tp __f) | |
529 | { | |
530 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
531 | return __builtin_isnormal(__type(__f)); | |
532 | } | |
7cda84dc BK |
533 | |
534 | template<typename _Tp> | |
0e7edcd5 PC |
535 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
536 | int>::__type | |
537 | signbit(_Tp __f) | |
538 | { | |
539 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
540 | return __builtin_signbit(__type(__f)); | |
541 | } | |
7cda84dc BK |
542 | |
543 | template<typename _Tp> | |
0e7edcd5 PC |
544 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
545 | int>::__type | |
3a2794ab | 546 | isgreater(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
547 | { |
548 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
549 | return __builtin_isgreater(__type(__f1), __type(__f2)); | |
550 | } | |
7cda84dc BK |
551 | |
552 | template<typename _Tp> | |
0e7edcd5 PC |
553 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
554 | int>::__type | |
7dd8177f | 555 | isgreaterequal(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
556 | { |
557 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
558 | return __builtin_isgreaterequal(__type(__f1), __type(__f2)); | |
559 | } | |
7cda84dc BK |
560 | |
561 | template<typename _Tp> | |
0e7edcd5 PC |
562 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
563 | int>::__type | |
3a2794ab | 564 | isless(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
565 | { |
566 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
567 | return __builtin_isless(__type(__f1), __type(__f2)); | |
568 | } | |
7cda84dc BK |
569 | |
570 | template<typename _Tp> | |
0e7edcd5 PC |
571 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
572 | int>::__type | |
7dd8177f | 573 | islessequal(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
574 | { |
575 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
576 | return __builtin_islessequal(__type(__f1), __type(__f2)); | |
577 | } | |
7cda84dc BK |
578 | |
579 | template<typename _Tp> | |
0e7edcd5 PC |
580 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
581 | int>::__type | |
7dd8177f | 582 | islessgreater(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
583 | { |
584 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
585 | return __builtin_islessgreater(__type(__f1), __type(__f2)); | |
586 | } | |
7cda84dc BK |
587 | |
588 | template<typename _Tp> | |
0e7edcd5 PC |
589 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
590 | int>::__type | |
7dd8177f | 591 | isunordered(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
592 | { |
593 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
594 | return __builtin_isunordered(__type(__f1), __type(__f2)); | |
595 | } | |
3cbc7af0 BK |
596 | |
597 | _GLIBCXX_END_NAMESPACE | |
598 | ||
3d7c150e | 599 | #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ |
7cda84dc | 600 | #endif |
7dd8177f | 601 | |
5f697f7a BK |
602 | #ifndef _GLIBCXX_EXPORT_TEMPLATE |
603 | # include <bits/cmath.tcc> | |
607642b6 | 604 | #endif |
22aef514 | 605 | |
98e6e789 | 606 | #endif |