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