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