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