]>
Commit | Line | Data |
---|---|---|
af13a7a6 BK |
1 | // -*- C++ -*- C forwarding header. |
2 | ||
a945c346 | 3 | // Copyright (C) 1997-2024 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 | ||
18f176d0 AA |
41 | #include <bits/requires_hosted.h> |
42 | ||
af13a7a6 BK |
43 | #include <bits/c++config.h> |
44 | #include <bits/cpp_type_traits.h> | |
45 | #include <ext/type_traits.h> | |
96e19ada JW |
46 | #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS |
47 | #include_next <math.h> | |
48 | #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS | |
37b204de | 49 | #include <bits/std_abs.h> |
af13a7a6 BK |
50 | |
51 | #ifndef _GLIBCXX_CMATH | |
52 | #define _GLIBCXX_CMATH 1 | |
53 | ||
083b7f28 AA |
54 | #define __glibcxx_want_hypot |
55 | #define __glibcxx_want_interpolate | |
56 | #include <bits/version.h> | |
57 | ||
af13a7a6 | 58 | // Get rid of those macros defined in <math.h> in lieu of real functions. |
af13a7a6 BK |
59 | #undef div |
60 | #undef acos | |
61 | #undef asin | |
62 | #undef atan | |
63 | #undef atan2 | |
64 | #undef ceil | |
65 | #undef cos | |
66 | #undef cosh | |
67 | #undef exp | |
68 | #undef fabs | |
69 | #undef floor | |
70 | #undef fmod | |
71 | #undef frexp | |
72 | #undef ldexp | |
73 | #undef log | |
74 | #undef log10 | |
75 | #undef modf | |
76 | #undef pow | |
77 | #undef sin | |
78 | #undef sinh | |
79 | #undef sqrt | |
80 | #undef tan | |
81 | #undef tanh | |
82 | ||
eac437bf JW |
83 | extern "C++" |
84 | { | |
12ffa228 BK |
85 | namespace std _GLIBCXX_VISIBILITY(default) |
86 | { | |
87 | _GLIBCXX_BEGIN_NAMESPACE_VERSION | |
af13a7a6 | 88 | |
af13a7a6 BK |
89 | using ::acos; |
90 | ||
7888f266 | 91 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 92 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
93 | acos(float __x) |
94 | { return __builtin_acosf(__x); } | |
95 | ||
fa459900 | 96 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
97 | acos(long double __x) |
98 | { return __builtin_acosl(__x); } | |
a1998fab | 99 | #endif |
af13a7a6 BK |
100 | |
101 | template<typename _Tp> | |
fa459900 PC |
102 | inline _GLIBCXX_CONSTEXPR |
103 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
104 | double>::__type | |
af13a7a6 BK |
105 | acos(_Tp __x) |
106 | { return __builtin_acos(__x); } | |
107 | ||
108 | using ::asin; | |
109 | ||
7888f266 | 110 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 111 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
112 | asin(float __x) |
113 | { return __builtin_asinf(__x); } | |
114 | ||
fa459900 | 115 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
116 | asin(long double __x) |
117 | { return __builtin_asinl(__x); } | |
a1998fab | 118 | #endif |
af13a7a6 BK |
119 | |
120 | template<typename _Tp> | |
fa459900 PC |
121 | inline _GLIBCXX_CONSTEXPR |
122 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
123 | double>::__type | |
af13a7a6 BK |
124 | asin(_Tp __x) |
125 | { return __builtin_asin(__x); } | |
126 | ||
127 | using ::atan; | |
128 | ||
7888f266 | 129 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 130 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
131 | atan(float __x) |
132 | { return __builtin_atanf(__x); } | |
133 | ||
fa459900 | 134 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
135 | atan(long double __x) |
136 | { return __builtin_atanl(__x); } | |
a1998fab | 137 | #endif |
af13a7a6 BK |
138 | |
139 | template<typename _Tp> | |
fa459900 PC |
140 | inline _GLIBCXX_CONSTEXPR |
141 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
142 | double>::__type | |
af13a7a6 BK |
143 | atan(_Tp __x) |
144 | { return __builtin_atan(__x); } | |
145 | ||
146 | using ::atan2; | |
147 | ||
7888f266 | 148 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 149 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
150 | atan2(float __y, float __x) |
151 | { return __builtin_atan2f(__y, __x); } | |
152 | ||
fa459900 | 153 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
154 | atan2(long double __y, long double __x) |
155 | { return __builtin_atan2l(__y, __x); } | |
a1998fab | 156 | #endif |
af13a7a6 | 157 | |
af13a7a6 BK |
158 | using ::ceil; |
159 | ||
7888f266 | 160 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 161 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
162 | ceil(float __x) |
163 | { return __builtin_ceilf(__x); } | |
164 | ||
fa459900 | 165 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
166 | ceil(long double __x) |
167 | { return __builtin_ceill(__x); } | |
a1998fab | 168 | #endif |
af13a7a6 BK |
169 | |
170 | template<typename _Tp> | |
fa459900 PC |
171 | inline _GLIBCXX_CONSTEXPR |
172 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
173 | double>::__type | |
af13a7a6 BK |
174 | ceil(_Tp __x) |
175 | { return __builtin_ceil(__x); } | |
176 | ||
177 | using ::cos; | |
178 | ||
7888f266 | 179 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 180 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
181 | cos(float __x) |
182 | { return __builtin_cosf(__x); } | |
183 | ||
fa459900 | 184 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
185 | cos(long double __x) |
186 | { return __builtin_cosl(__x); } | |
a1998fab | 187 | #endif |
af13a7a6 BK |
188 | |
189 | template<typename _Tp> | |
fa459900 PC |
190 | inline _GLIBCXX_CONSTEXPR |
191 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
192 | double>::__type | |
af13a7a6 BK |
193 | cos(_Tp __x) |
194 | { return __builtin_cos(__x); } | |
195 | ||
196 | using ::cosh; | |
197 | ||
7888f266 | 198 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 199 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
200 | cosh(float __x) |
201 | { return __builtin_coshf(__x); } | |
202 | ||
fa459900 | 203 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
204 | cosh(long double __x) |
205 | { return __builtin_coshl(__x); } | |
a1998fab | 206 | #endif |
af13a7a6 BK |
207 | |
208 | template<typename _Tp> | |
fa459900 PC |
209 | inline _GLIBCXX_CONSTEXPR |
210 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
211 | double>::__type | |
af13a7a6 BK |
212 | cosh(_Tp __x) |
213 | { return __builtin_cosh(__x); } | |
214 | ||
215 | using ::exp; | |
216 | ||
7888f266 | 217 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 218 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
219 | exp(float __x) |
220 | { return __builtin_expf(__x); } | |
221 | ||
fa459900 | 222 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
223 | exp(long double __x) |
224 | { return __builtin_expl(__x); } | |
a1998fab | 225 | #endif |
af13a7a6 BK |
226 | |
227 | template<typename _Tp> | |
fa459900 PC |
228 | inline _GLIBCXX_CONSTEXPR |
229 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
230 | double>::__type | |
af13a7a6 BK |
231 | exp(_Tp __x) |
232 | { return __builtin_exp(__x); } | |
233 | ||
234 | using ::fabs; | |
235 | ||
7888f266 | 236 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 237 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
238 | fabs(float __x) |
239 | { return __builtin_fabsf(__x); } | |
240 | ||
fa459900 | 241 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
242 | fabs(long double __x) |
243 | { return __builtin_fabsl(__x); } | |
a1998fab | 244 | #endif |
af13a7a6 BK |
245 | |
246 | template<typename _Tp> | |
fa459900 PC |
247 | inline _GLIBCXX_CONSTEXPR |
248 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
249 | double>::__type | |
af13a7a6 BK |
250 | fabs(_Tp __x) |
251 | { return __builtin_fabs(__x); } | |
252 | ||
253 | using ::floor; | |
254 | ||
7888f266 | 255 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 256 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
257 | floor(float __x) |
258 | { return __builtin_floorf(__x); } | |
259 | ||
fa459900 | 260 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
261 | floor(long double __x) |
262 | { return __builtin_floorl(__x); } | |
a1998fab | 263 | #endif |
af13a7a6 BK |
264 | |
265 | template<typename _Tp> | |
fa459900 PC |
266 | inline _GLIBCXX_CONSTEXPR |
267 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
268 | double>::__type | |
af13a7a6 BK |
269 | floor(_Tp __x) |
270 | { return __builtin_floor(__x); } | |
271 | ||
272 | using ::fmod; | |
273 | ||
7888f266 | 274 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 275 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
276 | fmod(float __x, float __y) |
277 | { return __builtin_fmodf(__x, __y); } | |
278 | ||
fa459900 | 279 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
280 | fmod(long double __x, long double __y) |
281 | { return __builtin_fmodl(__x, __y); } | |
a1998fab | 282 | #endif |
af13a7a6 BK |
283 | |
284 | using ::frexp; | |
285 | ||
7888f266 | 286 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
77addcb7 | 287 | inline float |
af13a7a6 BK |
288 | frexp(float __x, int* __exp) |
289 | { return __builtin_frexpf(__x, __exp); } | |
290 | ||
77addcb7 | 291 | inline long double |
af13a7a6 BK |
292 | frexp(long double __x, int* __exp) |
293 | { return __builtin_frexpl(__x, __exp); } | |
a1998fab | 294 | #endif |
af13a7a6 BK |
295 | |
296 | template<typename _Tp> | |
fa459900 PC |
297 | inline _GLIBCXX_CONSTEXPR |
298 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
299 | double>::__type | |
af13a7a6 BK |
300 | frexp(_Tp __x, int* __exp) |
301 | { return __builtin_frexp(__x, __exp); } | |
302 | ||
303 | using ::ldexp; | |
304 | ||
7888f266 | 305 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 306 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
307 | ldexp(float __x, int __exp) |
308 | { return __builtin_ldexpf(__x, __exp); } | |
309 | ||
fa459900 | 310 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
311 | ldexp(long double __x, int __exp) |
312 | { return __builtin_ldexpl(__x, __exp); } | |
a1998fab | 313 | #endif |
af13a7a6 BK |
314 | |
315 | template<typename _Tp> | |
fa459900 PC |
316 | inline _GLIBCXX_CONSTEXPR |
317 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
318 | double>::__type | |
e02d979a PC |
319 | ldexp(_Tp __x, int __exp) |
320 | { return __builtin_ldexp(__x, __exp); } | |
af13a7a6 BK |
321 | |
322 | using ::log; | |
323 | ||
7888f266 | 324 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 325 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
326 | log(float __x) |
327 | { return __builtin_logf(__x); } | |
328 | ||
fa459900 | 329 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
330 | log(long double __x) |
331 | { return __builtin_logl(__x); } | |
a1998fab | 332 | #endif |
af13a7a6 BK |
333 | |
334 | template<typename _Tp> | |
fa459900 PC |
335 | inline _GLIBCXX_CONSTEXPR |
336 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
337 | double>::__type | |
af13a7a6 BK |
338 | log(_Tp __x) |
339 | { return __builtin_log(__x); } | |
340 | ||
341 | using ::log10; | |
342 | ||
7888f266 | 343 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 344 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
345 | log10(float __x) |
346 | { return __builtin_log10f(__x); } | |
347 | ||
fa459900 | 348 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
349 | log10(long double __x) |
350 | { return __builtin_log10l(__x); } | |
a1998fab | 351 | #endif |
af13a7a6 BK |
352 | |
353 | template<typename _Tp> | |
fa459900 PC |
354 | inline _GLIBCXX_CONSTEXPR |
355 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
356 | double>::__type | |
af13a7a6 BK |
357 | log10(_Tp __x) |
358 | { return __builtin_log10(__x); } | |
359 | ||
360 | using ::modf; | |
361 | ||
7888f266 | 362 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
77addcb7 | 363 | inline float |
af13a7a6 BK |
364 | modf(float __x, float* __iptr) |
365 | { return __builtin_modff(__x, __iptr); } | |
366 | ||
77addcb7 | 367 | inline long double |
af13a7a6 BK |
368 | modf(long double __x, long double* __iptr) |
369 | { return __builtin_modfl(__x, __iptr); } | |
a1998fab | 370 | #endif |
af13a7a6 | 371 | |
af13a7a6 BK |
372 | using ::pow; |
373 | ||
7888f266 | 374 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 375 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
376 | pow(float __x, float __y) |
377 | { return __builtin_powf(__x, __y); } | |
378 | ||
fa459900 | 379 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
380 | pow(long double __x, long double __y) |
381 | { return __builtin_powl(__x, __y); } | |
382 | ||
734f5023 | 383 | #if __cplusplus < 201103L |
774c3d86 PC |
384 | // _GLIBCXX_RESOLVE_LIB_DEFECTS |
385 | // DR 550. What should the return type of pow(float,int) be? | |
af13a7a6 BK |
386 | inline double |
387 | pow(double __x, int __i) | |
388 | { return __builtin_powi(__x, __i); } | |
389 | ||
390 | inline float | |
391 | pow(float __x, int __n) | |
392 | { return __builtin_powif(__x, __n); } | |
393 | ||
394 | inline long double | |
395 | pow(long double __x, int __n) | |
396 | { return __builtin_powil(__x, __n); } | |
a1998fab | 397 | #endif |
774c3d86 | 398 | #endif |
af13a7a6 BK |
399 | |
400 | using ::sin; | |
401 | ||
7888f266 | 402 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 403 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
404 | sin(float __x) |
405 | { return __builtin_sinf(__x); } | |
406 | ||
fa459900 | 407 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
408 | sin(long double __x) |
409 | { return __builtin_sinl(__x); } | |
a1998fab | 410 | #endif |
af13a7a6 BK |
411 | |
412 | template<typename _Tp> | |
fa459900 PC |
413 | inline _GLIBCXX_CONSTEXPR |
414 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
415 | double>::__type | |
af13a7a6 BK |
416 | sin(_Tp __x) |
417 | { return __builtin_sin(__x); } | |
418 | ||
419 | using ::sinh; | |
420 | ||
7888f266 | 421 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 422 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
423 | sinh(float __x) |
424 | { return __builtin_sinhf(__x); } | |
425 | ||
fa459900 | 426 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
427 | sinh(long double __x) |
428 | { return __builtin_sinhl(__x); } | |
a1998fab | 429 | #endif |
af13a7a6 BK |
430 | |
431 | template<typename _Tp> | |
fa459900 PC |
432 | inline _GLIBCXX_CONSTEXPR |
433 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
434 | double>::__type | |
af13a7a6 BK |
435 | sinh(_Tp __x) |
436 | { return __builtin_sinh(__x); } | |
437 | ||
438 | using ::sqrt; | |
439 | ||
7888f266 | 440 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 441 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
442 | sqrt(float __x) |
443 | { return __builtin_sqrtf(__x); } | |
444 | ||
fa459900 | 445 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
446 | sqrt(long double __x) |
447 | { return __builtin_sqrtl(__x); } | |
a1998fab | 448 | #endif |
af13a7a6 BK |
449 | |
450 | template<typename _Tp> | |
fa459900 PC |
451 | inline _GLIBCXX_CONSTEXPR |
452 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
453 | double>::__type | |
af13a7a6 BK |
454 | sqrt(_Tp __x) |
455 | { return __builtin_sqrt(__x); } | |
456 | ||
457 | using ::tan; | |
458 | ||
7888f266 | 459 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 460 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
461 | tan(float __x) |
462 | { return __builtin_tanf(__x); } | |
463 | ||
fa459900 | 464 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
465 | tan(long double __x) |
466 | { return __builtin_tanl(__x); } | |
a1998fab | 467 | #endif |
af13a7a6 BK |
468 | |
469 | template<typename _Tp> | |
fa459900 PC |
470 | inline _GLIBCXX_CONSTEXPR |
471 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
472 | double>::__type | |
af13a7a6 BK |
473 | tan(_Tp __x) |
474 | { return __builtin_tan(__x); } | |
475 | ||
476 | using ::tanh; | |
477 | ||
7888f266 | 478 | #ifndef __CORRECT_ISO_CPP_MATH_H_PROTO |
fa459900 | 479 | inline _GLIBCXX_CONSTEXPR float |
af13a7a6 BK |
480 | tanh(float __x) |
481 | { return __builtin_tanhf(__x); } | |
482 | ||
fa459900 | 483 | inline _GLIBCXX_CONSTEXPR long double |
af13a7a6 BK |
484 | tanh(long double __x) |
485 | { return __builtin_tanhl(__x); } | |
a1998fab | 486 | #endif |
af13a7a6 BK |
487 | |
488 | template<typename _Tp> | |
fa459900 PC |
489 | inline _GLIBCXX_CONSTEXPR |
490 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
491 | double>::__type | |
af13a7a6 BK |
492 | tanh(_Tp __x) |
493 | { return __builtin_tanh(__x); } | |
494 | ||
a23225fb JJ |
495 | #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) |
496 | constexpr _Float16 | |
497 | acos(_Float16 __x) | |
498 | { return _Float16(__builtin_acosf(__x)); } | |
499 | ||
500 | constexpr _Float16 | |
501 | asin(_Float16 __x) | |
502 | { return _Float16(__builtin_asinf(__x)); } | |
503 | ||
504 | constexpr _Float16 | |
505 | atan(_Float16 __x) | |
506 | { return _Float16(__builtin_atanf(__x)); } | |
507 | ||
508 | constexpr _Float16 | |
509 | atan2(_Float16 __y, _Float16 __x) | |
510 | { return _Float16(__builtin_atan2f(__y, __x)); } | |
511 | ||
512 | constexpr _Float16 | |
513 | ceil(_Float16 __x) | |
514 | { return _Float16(__builtin_ceilf(__x)); } | |
515 | ||
516 | constexpr _Float16 | |
517 | cos(_Float16 __x) | |
518 | { return _Float16(__builtin_cosf(__x)); } | |
519 | ||
520 | constexpr _Float16 | |
521 | cosh(_Float16 __x) | |
522 | { return _Float16(__builtin_coshf(__x)); } | |
523 | ||
524 | constexpr _Float16 | |
525 | exp(_Float16 __x) | |
526 | { return _Float16(__builtin_expf(__x)); } | |
527 | ||
528 | constexpr _Float16 | |
529 | fabs(_Float16 __x) | |
530 | { return _Float16(__builtin_fabsf(__x)); } | |
531 | ||
532 | constexpr _Float16 | |
533 | floor(_Float16 __x) | |
534 | { return _Float16(__builtin_floorf(__x)); } | |
535 | ||
536 | constexpr _Float16 | |
537 | fmod(_Float16 __x, _Float16 __y) | |
538 | { return _Float16(__builtin_fmodf(__x, __y)); } | |
539 | ||
540 | inline _Float16 | |
541 | frexp(_Float16 __x, int* __exp) | |
542 | { return _Float16(__builtin_frexpf(__x, __exp)); } | |
543 | ||
544 | constexpr _Float16 | |
545 | ldexp(_Float16 __x, int __exp) | |
546 | { return _Float16(__builtin_ldexpf(__x, __exp)); } | |
547 | ||
548 | constexpr _Float16 | |
549 | log(_Float16 __x) | |
550 | { return _Float16(__builtin_logf(__x)); } | |
551 | ||
552 | constexpr _Float16 | |
553 | log10(_Float16 __x) | |
554 | { return _Float16(__builtin_log10f(__x)); } | |
555 | ||
556 | inline _Float16 | |
557 | modf(_Float16 __x, _Float16* __iptr) | |
558 | { | |
559 | float __i, __ret = __builtin_modff(__x, &__i); | |
560 | *__iptr = _Float16(__i); | |
561 | return _Float16(__ret); | |
562 | } | |
563 | ||
564 | constexpr _Float16 | |
565 | pow(_Float16 __x, _Float16 __y) | |
566 | { return _Float16(__builtin_powf(__x, __y)); } | |
567 | ||
568 | constexpr _Float16 | |
569 | sin(_Float16 __x) | |
570 | { return _Float16(__builtin_sinf(__x)); } | |
571 | ||
572 | constexpr _Float16 | |
573 | sinh(_Float16 __x) | |
574 | { return _Float16(__builtin_sinhf(__x)); } | |
575 | ||
576 | constexpr _Float16 | |
577 | sqrt(_Float16 __x) | |
578 | { return _Float16(__builtin_sqrtf(__x)); } | |
579 | ||
580 | constexpr _Float16 | |
581 | tan(_Float16 __x) | |
582 | { return _Float16(__builtin_tanf(__x)); } | |
583 | ||
584 | constexpr _Float16 | |
585 | tanh(_Float16 __x) | |
586 | { return _Float16(__builtin_tanhf(__x)); } | |
587 | #endif | |
588 | ||
589 | #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
590 | constexpr _Float32 | |
591 | acos(_Float32 __x) | |
592 | { return __builtin_acosf(__x); } | |
593 | ||
594 | constexpr _Float32 | |
595 | asin(_Float32 __x) | |
596 | { return __builtin_asinf(__x); } | |
597 | ||
598 | constexpr _Float32 | |
599 | atan(_Float32 __x) | |
600 | { return __builtin_atanf(__x); } | |
601 | ||
602 | constexpr _Float32 | |
603 | atan2(_Float32 __y, _Float32 __x) | |
604 | { return __builtin_atan2f(__y, __x); } | |
605 | ||
606 | constexpr _Float32 | |
607 | ceil(_Float32 __x) | |
608 | { return __builtin_ceilf(__x); } | |
609 | ||
610 | constexpr _Float32 | |
611 | cos(_Float32 __x) | |
612 | { return __builtin_cosf(__x); } | |
613 | ||
614 | constexpr _Float32 | |
615 | cosh(_Float32 __x) | |
616 | { return __builtin_coshf(__x); } | |
617 | ||
618 | constexpr _Float32 | |
619 | exp(_Float32 __x) | |
620 | { return __builtin_expf(__x); } | |
621 | ||
622 | constexpr _Float32 | |
623 | fabs(_Float32 __x) | |
624 | { return __builtin_fabsf(__x); } | |
625 | ||
626 | constexpr _Float32 | |
627 | floor(_Float32 __x) | |
628 | { return __builtin_floorf(__x); } | |
629 | ||
630 | constexpr _Float32 | |
631 | fmod(_Float32 __x, _Float32 __y) | |
632 | { return __builtin_fmodf(__x, __y); } | |
633 | ||
634 | inline _Float32 | |
635 | frexp(_Float32 __x, int* __exp) | |
636 | { return __builtin_frexpf(__x, __exp); } | |
637 | ||
638 | constexpr _Float32 | |
639 | ldexp(_Float32 __x, int __exp) | |
640 | { return __builtin_ldexpf(__x, __exp); } | |
641 | ||
642 | constexpr _Float32 | |
643 | log(_Float32 __x) | |
644 | { return __builtin_logf(__x); } | |
645 | ||
646 | constexpr _Float32 | |
647 | log10(_Float32 __x) | |
648 | { return __builtin_log10f(__x); } | |
649 | ||
650 | inline _Float32 | |
651 | modf(_Float32 __x, _Float32* __iptr) | |
652 | { | |
653 | float __i, __ret = __builtin_modff(__x, &__i); | |
654 | *__iptr = __i; | |
655 | return __ret; | |
656 | } | |
657 | ||
658 | constexpr _Float32 | |
659 | pow(_Float32 __x, _Float32 __y) | |
660 | { return __builtin_powf(__x, __y); } | |
661 | ||
662 | constexpr _Float32 | |
663 | sin(_Float32 __x) | |
664 | { return __builtin_sinf(__x); } | |
665 | ||
666 | constexpr _Float32 | |
667 | sinh(_Float32 __x) | |
668 | { return __builtin_sinhf(__x); } | |
669 | ||
670 | constexpr _Float32 | |
671 | sqrt(_Float32 __x) | |
672 | { return __builtin_sqrtf(__x); } | |
673 | ||
674 | constexpr _Float32 | |
675 | tan(_Float32 __x) | |
676 | { return __builtin_tanf(__x); } | |
677 | ||
678 | constexpr _Float32 | |
679 | tanh(_Float32 __x) | |
680 | { return __builtin_tanhf(__x); } | |
681 | #endif | |
682 | ||
683 | #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) | |
684 | constexpr _Float64 | |
685 | acos(_Float64 __x) | |
686 | { return __builtin_acos(__x); } | |
687 | ||
688 | constexpr _Float64 | |
689 | asin(_Float64 __x) | |
690 | { return __builtin_asin(__x); } | |
691 | ||
692 | constexpr _Float64 | |
693 | atan(_Float64 __x) | |
694 | { return __builtin_atan(__x); } | |
695 | ||
696 | constexpr _Float64 | |
697 | atan2(_Float64 __y, _Float64 __x) | |
698 | { return __builtin_atan2(__y, __x); } | |
699 | ||
700 | constexpr _Float64 | |
701 | ceil(_Float64 __x) | |
702 | { return __builtin_ceil(__x); } | |
703 | ||
704 | constexpr _Float64 | |
705 | cos(_Float64 __x) | |
706 | { return __builtin_cos(__x); } | |
707 | ||
708 | constexpr _Float64 | |
709 | cosh(_Float64 __x) | |
710 | { return __builtin_cosh(__x); } | |
711 | ||
712 | constexpr _Float64 | |
713 | exp(_Float64 __x) | |
714 | { return __builtin_exp(__x); } | |
715 | ||
716 | constexpr _Float64 | |
717 | fabs(_Float64 __x) | |
718 | { return __builtin_fabs(__x); } | |
719 | ||
720 | constexpr _Float64 | |
721 | floor(_Float64 __x) | |
722 | { return __builtin_floor(__x); } | |
723 | ||
724 | constexpr _Float64 | |
725 | fmod(_Float64 __x, _Float64 __y) | |
726 | { return __builtin_fmod(__x, __y); } | |
727 | ||
728 | inline _Float64 | |
729 | frexp(_Float64 __x, int* __exp) | |
730 | { return __builtin_frexp(__x, __exp); } | |
731 | ||
732 | constexpr _Float64 | |
733 | ldexp(_Float64 __x, int __exp) | |
734 | { return __builtin_ldexp(__x, __exp); } | |
735 | ||
736 | constexpr _Float64 | |
737 | log(_Float64 __x) | |
738 | { return __builtin_log(__x); } | |
739 | ||
740 | constexpr _Float64 | |
741 | log10(_Float64 __x) | |
742 | { return __builtin_log10(__x); } | |
743 | ||
744 | inline _Float64 | |
745 | modf(_Float64 __x, _Float64* __iptr) | |
746 | { | |
747 | double __i, __ret = __builtin_modf(__x, &__i); | |
748 | *__iptr = __i; | |
749 | return __ret; | |
750 | } | |
751 | ||
752 | constexpr _Float64 | |
753 | pow(_Float64 __x, _Float64 __y) | |
754 | { return __builtin_pow(__x, __y); } | |
755 | ||
756 | constexpr _Float64 | |
757 | sin(_Float64 __x) | |
758 | { return __builtin_sin(__x); } | |
759 | ||
760 | constexpr _Float64 | |
761 | sinh(_Float64 __x) | |
762 | { return __builtin_sinh(__x); } | |
763 | ||
764 | constexpr _Float64 | |
765 | sqrt(_Float64 __x) | |
766 | { return __builtin_sqrt(__x); } | |
767 | ||
768 | constexpr _Float64 | |
769 | tan(_Float64 __x) | |
770 | { return __builtin_tan(__x); } | |
771 | ||
772 | constexpr _Float64 | |
773 | tanh(_Float64 __x) | |
774 | { return __builtin_tanh(__x); } | |
775 | #endif | |
776 | ||
777 | #if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) | |
778 | constexpr _Float128 | |
779 | acos(_Float128 __x) | |
780 | { return __builtin_acosl(__x); } | |
781 | ||
782 | constexpr _Float128 | |
783 | asin(_Float128 __x) | |
784 | { return __builtin_asinl(__x); } | |
785 | ||
786 | constexpr _Float128 | |
787 | atan(_Float128 __x) | |
788 | { return __builtin_atanl(__x); } | |
789 | ||
790 | constexpr _Float128 | |
791 | atan2(_Float128 __y, _Float128 __x) | |
792 | { return __builtin_atan2l(__y, __x); } | |
793 | ||
794 | constexpr _Float128 | |
795 | ceil(_Float128 __x) | |
796 | { return __builtin_ceill(__x); } | |
797 | ||
798 | constexpr _Float128 | |
799 | cos(_Float128 __x) | |
800 | { return __builtin_cosl(__x); } | |
801 | ||
802 | constexpr _Float128 | |
803 | cosh(_Float128 __x) | |
804 | { return __builtin_coshl(__x); } | |
805 | ||
806 | constexpr _Float128 | |
807 | exp(_Float128 __x) | |
808 | { return __builtin_expl(__x); } | |
809 | ||
810 | constexpr _Float128 | |
811 | fabs(_Float128 __x) | |
812 | { return __builtin_fabsl(__x); } | |
813 | ||
814 | constexpr _Float128 | |
815 | floor(_Float128 __x) | |
816 | { return __builtin_floorl(__x); } | |
817 | ||
818 | constexpr _Float128 | |
819 | fmod(_Float128 __x, _Float128 __y) | |
820 | { return __builtin_fmodl(__x, __y); } | |
821 | ||
822 | inline _Float128 | |
823 | frexp(_Float128 __x, int* __exp) | |
824 | { return __builtin_frexpl(__x, __exp); } | |
825 | ||
826 | constexpr _Float128 | |
827 | ldexp(_Float128 __x, int __exp) | |
828 | { return __builtin_ldexpl(__x, __exp); } | |
829 | ||
830 | constexpr _Float128 | |
831 | log(_Float128 __x) | |
832 | { return __builtin_logl(__x); } | |
833 | ||
834 | constexpr _Float128 | |
835 | log10(_Float128 __x) | |
836 | { return __builtin_log10l(__x); } | |
837 | ||
838 | inline _Float128 | |
839 | modf(_Float128 __x, _Float128* __iptr) | |
840 | { | |
841 | long double __i, __ret = __builtin_modfl(__x, &__i); | |
842 | *__iptr = __i; | |
843 | return __ret; | |
844 | } | |
845 | ||
846 | constexpr _Float128 | |
847 | pow(_Float128 __x, _Float128 __y) | |
848 | { return __builtin_powl(__x, __y); } | |
849 | ||
850 | constexpr _Float128 | |
851 | sin(_Float128 __x) | |
852 | { return __builtin_sinl(__x); } | |
853 | ||
854 | constexpr _Float128 | |
855 | sinh(_Float128 __x) | |
856 | { return __builtin_sinhl(__x); } | |
857 | ||
858 | constexpr _Float128 | |
859 | sqrt(_Float128 __x) | |
860 | { return __builtin_sqrtl(__x); } | |
861 | ||
862 | constexpr _Float128 | |
863 | tan(_Float128 __x) | |
864 | { return __builtin_tanl(__x); } | |
865 | ||
866 | constexpr _Float128 | |
867 | tanh(_Float128 __x) | |
868 | { return __builtin_tanhl(__x); } | |
869 | #elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH) | |
870 | constexpr _Float128 | |
871 | acos(_Float128 __x) | |
872 | { return __builtin_acosf128(__x); } | |
873 | ||
874 | constexpr _Float128 | |
875 | asin(_Float128 __x) | |
876 | { return __builtin_asinf128(__x); } | |
877 | ||
878 | constexpr _Float128 | |
879 | atan(_Float128 __x) | |
880 | { return __builtin_atanf128(__x); } | |
881 | ||
882 | constexpr _Float128 | |
883 | atan2(_Float128 __y, _Float128 __x) | |
884 | { return __builtin_atan2f128(__y, __x); } | |
885 | ||
886 | constexpr _Float128 | |
887 | ceil(_Float128 __x) | |
888 | { return __builtin_ceilf128(__x); } | |
889 | ||
890 | constexpr _Float128 | |
891 | cos(_Float128 __x) | |
892 | { return __builtin_cosf128(__x); } | |
893 | ||
894 | constexpr _Float128 | |
895 | cosh(_Float128 __x) | |
896 | { return __builtin_coshf128(__x); } | |
897 | ||
898 | constexpr _Float128 | |
899 | exp(_Float128 __x) | |
900 | { return __builtin_expf128(__x); } | |
901 | ||
902 | constexpr _Float128 | |
903 | fabs(_Float128 __x) | |
904 | { return __builtin_fabsf128(__x); } | |
905 | ||
906 | constexpr _Float128 | |
907 | floor(_Float128 __x) | |
908 | { return __builtin_floorf128(__x); } | |
909 | ||
910 | constexpr _Float128 | |
911 | fmod(_Float128 __x, _Float128 __y) | |
912 | { return __builtin_fmodf128(__x, __y); } | |
913 | ||
914 | inline _Float128 | |
915 | frexp(_Float128 __x, int* __exp) | |
916 | { return __builtin_frexpf128(__x, __exp); } | |
917 | ||
918 | constexpr _Float128 | |
919 | ldexp(_Float128 __x, int __exp) | |
920 | { return __builtin_ldexpf128(__x, __exp); } | |
921 | ||
922 | constexpr _Float128 | |
923 | log(_Float128 __x) | |
924 | { return __builtin_logf128(__x); } | |
925 | ||
926 | constexpr _Float128 | |
927 | log10(_Float128 __x) | |
928 | { return __builtin_log10f128(__x); } | |
929 | ||
930 | inline _Float128 | |
931 | modf(_Float128 __x, _Float128* __iptr) | |
932 | { return __builtin_modff128(__x, __iptr); } | |
933 | ||
934 | constexpr _Float128 | |
935 | pow(_Float128 __x, _Float128 __y) | |
936 | { return __builtin_powf128(__x, __y); } | |
937 | ||
938 | constexpr _Float128 | |
939 | sin(_Float128 __x) | |
940 | { return __builtin_sinf128(__x); } | |
941 | ||
942 | constexpr _Float128 | |
943 | sinh(_Float128 __x) | |
944 | { return __builtin_sinhf128(__x); } | |
945 | ||
946 | constexpr _Float128 | |
947 | sqrt(_Float128 __x) | |
948 | { return __builtin_sqrtf128(__x); } | |
949 | ||
950 | constexpr _Float128 | |
951 | tan(_Float128 __x) | |
952 | { return __builtin_tanf128(__x); } | |
953 | ||
954 | constexpr _Float128 | |
955 | tanh(_Float128 __x) | |
956 | { return __builtin_tanhf128(__x); } | |
957 | #endif | |
958 | ||
959 | #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
960 | constexpr __gnu_cxx::__bfloat16_t | |
961 | acos(__gnu_cxx::__bfloat16_t __x) | |
962 | { return __gnu_cxx::__bfloat16_t(__builtin_acosf(__x)); } | |
963 | ||
964 | constexpr __gnu_cxx::__bfloat16_t | |
965 | asin(__gnu_cxx::__bfloat16_t __x) | |
966 | { return __gnu_cxx::__bfloat16_t(__builtin_asinf(__x)); } | |
967 | ||
968 | constexpr __gnu_cxx::__bfloat16_t | |
969 | atan(__gnu_cxx::__bfloat16_t __x) | |
970 | { return __gnu_cxx::__bfloat16_t(__builtin_atanf(__x)); } | |
971 | ||
972 | constexpr __gnu_cxx::__bfloat16_t | |
973 | atan2(__gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __x) | |
974 | { return __gnu_cxx::__bfloat16_t(__builtin_atan2f(__y, __x)); } | |
975 | ||
976 | constexpr __gnu_cxx::__bfloat16_t | |
977 | ceil(__gnu_cxx::__bfloat16_t __x) | |
978 | { return __gnu_cxx::__bfloat16_t(__builtin_ceilf(__x)); } | |
979 | ||
980 | constexpr __gnu_cxx::__bfloat16_t | |
981 | cos(__gnu_cxx::__bfloat16_t __x) | |
982 | { return __gnu_cxx::__bfloat16_t(__builtin_cosf(__x)); } | |
983 | ||
984 | constexpr __gnu_cxx::__bfloat16_t | |
985 | cosh(__gnu_cxx::__bfloat16_t __x) | |
986 | { return __gnu_cxx::__bfloat16_t(__builtin_coshf(__x)); } | |
987 | ||
988 | constexpr __gnu_cxx::__bfloat16_t | |
989 | exp(__gnu_cxx::__bfloat16_t __x) | |
990 | { return __gnu_cxx::__bfloat16_t(__builtin_expf(__x)); } | |
991 | ||
992 | constexpr __gnu_cxx::__bfloat16_t | |
993 | fabs(__gnu_cxx::__bfloat16_t __x) | |
994 | { return __gnu_cxx::__bfloat16_t(__builtin_fabsf(__x)); } | |
995 | ||
996 | constexpr __gnu_cxx::__bfloat16_t | |
997 | floor(__gnu_cxx::__bfloat16_t __x) | |
998 | { return __gnu_cxx::__bfloat16_t(__builtin_floorf(__x)); } | |
999 | ||
1000 | constexpr __gnu_cxx::__bfloat16_t | |
1001 | fmod(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1002 | { return __gnu_cxx::__bfloat16_t(__builtin_fmodf(__x, __y)); } | |
1003 | ||
1004 | inline __gnu_cxx::__bfloat16_t | |
1005 | frexp(__gnu_cxx::__bfloat16_t __x, int* __exp) | |
1006 | { return __gnu_cxx::__bfloat16_t(__builtin_frexpf(__x, __exp)); } | |
1007 | ||
1008 | constexpr __gnu_cxx::__bfloat16_t | |
1009 | ldexp(__gnu_cxx::__bfloat16_t __x, int __exp) | |
1010 | { return __gnu_cxx::__bfloat16_t(__builtin_ldexpf(__x, __exp)); } | |
1011 | ||
1012 | constexpr __gnu_cxx::__bfloat16_t | |
1013 | log(__gnu_cxx::__bfloat16_t __x) | |
1014 | { return __gnu_cxx::__bfloat16_t(__builtin_logf(__x)); } | |
1015 | ||
1016 | constexpr __gnu_cxx::__bfloat16_t | |
1017 | log10(__gnu_cxx::__bfloat16_t __x) | |
1018 | { return __gnu_cxx::__bfloat16_t(__builtin_log10f(__x)); } | |
1019 | ||
1020 | inline __gnu_cxx::__bfloat16_t | |
1021 | modf(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t* __iptr) | |
1022 | { | |
1023 | float __i, __ret = __builtin_modff(__x, &__i); | |
1024 | *__iptr = __gnu_cxx::__bfloat16_t(__i); | |
1025 | return __gnu_cxx::__bfloat16_t(__ret); | |
1026 | } | |
1027 | ||
1028 | constexpr __gnu_cxx::__bfloat16_t | |
1029 | pow(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1030 | { return __gnu_cxx::__bfloat16_t(__builtin_powf(__x, __y)); } | |
1031 | ||
1032 | constexpr __gnu_cxx::__bfloat16_t | |
1033 | sin(__gnu_cxx::__bfloat16_t __x) | |
1034 | { return __gnu_cxx::__bfloat16_t(__builtin_sinf(__x)); } | |
1035 | ||
1036 | constexpr __gnu_cxx::__bfloat16_t | |
1037 | sinh(__gnu_cxx::__bfloat16_t __x) | |
1038 | { return __gnu_cxx::__bfloat16_t(__builtin_sinhf(__x)); } | |
1039 | ||
1040 | constexpr __gnu_cxx::__bfloat16_t | |
1041 | sqrt(__gnu_cxx::__bfloat16_t __x) | |
1042 | { return __gnu_cxx::__bfloat16_t(__builtin_sqrtf(__x)); } | |
1043 | ||
1044 | constexpr __gnu_cxx::__bfloat16_t | |
1045 | tan(__gnu_cxx::__bfloat16_t __x) | |
1046 | { return __gnu_cxx::__bfloat16_t(__builtin_tanf(__x)); } | |
1047 | ||
1048 | constexpr __gnu_cxx::__bfloat16_t | |
1049 | tanh(__gnu_cxx::__bfloat16_t __x) | |
1050 | { return __gnu_cxx::__bfloat16_t(__builtin_tanhf(__x)); } | |
1051 | #endif | |
1052 | ||
883f1e25 JJ |
1053 | template<typename _Tp, typename _Up> |
1054 | inline _GLIBCXX_CONSTEXPR | |
1055 | typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
1056 | atan2(_Tp __y, _Up __x) | |
1057 | { | |
1058 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1059 | return atan2(__type(__y), __type(__x)); | |
1060 | } | |
1061 | ||
1062 | template<typename _Tp, typename _Up> | |
1063 | inline _GLIBCXX_CONSTEXPR | |
1064 | typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
1065 | fmod(_Tp __x, _Up __y) | |
1066 | { | |
1067 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1068 | return fmod(__type(__x), __type(__y)); | |
1069 | } | |
1070 | ||
1071 | template<typename _Tp, typename _Up> | |
1072 | inline _GLIBCXX_CONSTEXPR | |
1073 | typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
1074 | pow(_Tp __x, _Up __y) | |
1075 | { | |
1076 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1077 | return pow(__type(__x), __type(__y)); | |
1078 | } | |
1079 | ||
af13a7a6 BK |
1080 | #if _GLIBCXX_USE_C99_MATH |
1081 | #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC | |
af13a7a6 | 1082 | |
57317d2a | 1083 | // These are possible macros imported from C99-land. |
af13a7a6 BK |
1084 | #undef fpclassify |
1085 | #undef isfinite | |
1086 | #undef isinf | |
1087 | #undef isnan | |
1088 | #undef isnormal | |
1089 | #undef signbit | |
1090 | #undef isgreater | |
1091 | #undef isgreaterequal | |
1092 | #undef isless | |
1093 | #undef islessequal | |
1094 | #undef islessgreater | |
1095 | #undef isunordered | |
1096 | ||
734f5023 | 1097 | #if __cplusplus >= 201103L |
ef3a7506 | 1098 | |
3115f94f | 1099 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1100 | constexpr int |
77fd1c1d PC |
1101 | fpclassify(float __x) |
1102 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1103 | FP_SUBNORMAL, FP_ZERO, __x); } | |
1104 | ||
fa459900 | 1105 | constexpr int |
77fd1c1d PC |
1106 | fpclassify(double __x) |
1107 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1108 | FP_SUBNORMAL, FP_ZERO, __x); } | |
1109 | ||
fa459900 | 1110 | constexpr int |
77fd1c1d PC |
1111 | fpclassify(long double __x) |
1112 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1113 | FP_SUBNORMAL, FP_ZERO, __x); } | |
ef3a7506 | 1114 | #endif |
77fd1c1d | 1115 | |
3115f94f | 1116 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1117 | template<typename _Tp> |
fa459900 PC |
1118 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
1119 | int>::__type | |
77fd1c1d PC |
1120 | fpclassify(_Tp __x) |
1121 | { return __x != 0 ? FP_NORMAL : FP_ZERO; } | |
3115f94f | 1122 | #endif |
77fd1c1d | 1123 | |
3115f94f | 1124 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1125 | constexpr bool |
77fd1c1d PC |
1126 | isfinite(float __x) |
1127 | { return __builtin_isfinite(__x); } | |
1128 | ||
fa459900 | 1129 | constexpr bool |
77fd1c1d PC |
1130 | isfinite(double __x) |
1131 | { return __builtin_isfinite(__x); } | |
1132 | ||
fa459900 | 1133 | constexpr bool |
77fd1c1d PC |
1134 | isfinite(long double __x) |
1135 | { return __builtin_isfinite(__x); } | |
ef3a7506 | 1136 | #endif |
77fd1c1d | 1137 | |
3115f94f | 1138 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1139 | template<typename _Tp> |
fa459900 PC |
1140 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
1141 | bool>::__type | |
af89c779 | 1142 | isfinite(_Tp) |
77fd1c1d | 1143 | { return true; } |
3115f94f | 1144 | #endif |
77fd1c1d | 1145 | |
3115f94f | 1146 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1147 | constexpr bool |
77fd1c1d | 1148 | isinf(float __x) |
750867b7 | 1149 | { return __builtin_isinf(__x); } |
77fd1c1d | 1150 | |
69b0daeb | 1151 | #if _GLIBCXX_HAVE_OBSOLETE_ISINF \ |
350fe282 | 1152 | && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC |
39a1d8c8 JW |
1153 | using ::isinf; |
1154 | #else | |
fa459900 | 1155 | constexpr bool |
77fd1c1d | 1156 | isinf(double __x) |
750867b7 | 1157 | { return __builtin_isinf(__x); } |
39a1d8c8 | 1158 | #endif |
77fd1c1d | 1159 | |
fa459900 | 1160 | constexpr bool |
77fd1c1d | 1161 | isinf(long double __x) |
750867b7 | 1162 | { return __builtin_isinf(__x); } |
ef3a7506 | 1163 | #endif |
77fd1c1d | 1164 | |
3115f94f | 1165 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1166 | template<typename _Tp> |
fa459900 PC |
1167 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
1168 | bool>::__type | |
af89c779 | 1169 | isinf(_Tp) |
77fd1c1d | 1170 | { return false; } |
3115f94f | 1171 | #endif |
77fd1c1d | 1172 | |
3115f94f | 1173 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1174 | constexpr bool |
77fd1c1d PC |
1175 | isnan(float __x) |
1176 | { return __builtin_isnan(__x); } | |
1177 | ||
69b0daeb | 1178 | #if _GLIBCXX_HAVE_OBSOLETE_ISNAN \ |
350fe282 | 1179 | && !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC |
39a1d8c8 JW |
1180 | using ::isnan; |
1181 | #else | |
fa459900 | 1182 | constexpr bool |
77fd1c1d PC |
1183 | isnan(double __x) |
1184 | { return __builtin_isnan(__x); } | |
39a1d8c8 | 1185 | #endif |
77fd1c1d | 1186 | |
fa459900 | 1187 | constexpr bool |
77fd1c1d PC |
1188 | isnan(long double __x) |
1189 | { return __builtin_isnan(__x); } | |
ef3a7506 | 1190 | #endif |
77fd1c1d | 1191 | |
3115f94f | 1192 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1193 | template<typename _Tp> |
fa459900 PC |
1194 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
1195 | bool>::__type | |
af89c779 | 1196 | isnan(_Tp) |
77fd1c1d | 1197 | { return false; } |
3115f94f | 1198 | #endif |
77fd1c1d | 1199 | |
3115f94f | 1200 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1201 | constexpr bool |
77fd1c1d PC |
1202 | isnormal(float __x) |
1203 | { return __builtin_isnormal(__x); } | |
1204 | ||
fa459900 | 1205 | constexpr bool |
77fd1c1d PC |
1206 | isnormal(double __x) |
1207 | { return __builtin_isnormal(__x); } | |
1208 | ||
fa459900 | 1209 | constexpr bool |
77fd1c1d PC |
1210 | isnormal(long double __x) |
1211 | { return __builtin_isnormal(__x); } | |
ef3a7506 | 1212 | #endif |
77fd1c1d | 1213 | |
3115f94f | 1214 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1215 | template<typename _Tp> |
fa459900 PC |
1216 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
1217 | bool>::__type | |
77fd1c1d PC |
1218 | isnormal(_Tp __x) |
1219 | { return __x != 0 ? true : false; } | |
3115f94f | 1220 | #endif |
77fd1c1d | 1221 | |
3115f94f | 1222 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
dce573c4 | 1223 | // Note: middle-end/36757 is fixed, __builtin_signbit is type-generic. |
fa459900 | 1224 | constexpr bool |
77fd1c1d | 1225 | signbit(float __x) |
157177af | 1226 | { return __builtin_signbit(__x); } |
77fd1c1d | 1227 | |
fa459900 | 1228 | constexpr bool |
77fd1c1d PC |
1229 | signbit(double __x) |
1230 | { return __builtin_signbit(__x); } | |
1231 | ||
fa459900 | 1232 | constexpr bool |
77fd1c1d | 1233 | signbit(long double __x) |
157177af | 1234 | { return __builtin_signbit(__x); } |
ef3a7506 | 1235 | #endif |
77fd1c1d | 1236 | |
3115f94f | 1237 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1238 | template<typename _Tp> |
fa459900 PC |
1239 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
1240 | bool>::__type | |
77fd1c1d PC |
1241 | signbit(_Tp __x) |
1242 | { return __x < 0 ? true : false; } | |
3115f94f | 1243 | #endif |
77fd1c1d | 1244 | |
3115f94f | 1245 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1246 | constexpr bool |
77fd1c1d PC |
1247 | isgreater(float __x, float __y) |
1248 | { return __builtin_isgreater(__x, __y); } | |
1249 | ||
fa459900 | 1250 | constexpr bool |
77fd1c1d PC |
1251 | isgreater(double __x, double __y) |
1252 | { return __builtin_isgreater(__x, __y); } | |
1253 | ||
fa459900 | 1254 | constexpr bool |
77fd1c1d PC |
1255 | isgreater(long double __x, long double __y) |
1256 | { return __builtin_isgreater(__x, __y); } | |
ef3a7506 | 1257 | #endif |
77fd1c1d | 1258 | |
3115f94f | 1259 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1260 | template<typename _Tp, typename _Up> |
fa459900 | 1261 | constexpr typename |
77fd1c1d PC |
1262 | __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value |
1263 | && __is_arithmetic<_Up>::__value), bool>::__type | |
1264 | isgreater(_Tp __x, _Up __y) | |
1265 | { | |
1266 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1267 | return __builtin_isgreater(__type(__x), __type(__y)); | |
1268 | } | |
3115f94f | 1269 | #endif |
77fd1c1d | 1270 | |
3115f94f | 1271 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1272 | constexpr bool |
77fd1c1d PC |
1273 | isgreaterequal(float __x, float __y) |
1274 | { return __builtin_isgreaterequal(__x, __y); } | |
1275 | ||
fa459900 | 1276 | constexpr bool |
77fd1c1d PC |
1277 | isgreaterequal(double __x, double __y) |
1278 | { return __builtin_isgreaterequal(__x, __y); } | |
1279 | ||
fa459900 | 1280 | constexpr bool |
77fd1c1d PC |
1281 | isgreaterequal(long double __x, long double __y) |
1282 | { return __builtin_isgreaterequal(__x, __y); } | |
ef3a7506 | 1283 | #endif |
77fd1c1d | 1284 | |
3115f94f | 1285 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1286 | template<typename _Tp, typename _Up> |
fa459900 | 1287 | constexpr typename |
77fd1c1d PC |
1288 | __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value |
1289 | && __is_arithmetic<_Up>::__value), bool>::__type | |
1290 | isgreaterequal(_Tp __x, _Up __y) | |
1291 | { | |
1292 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1293 | return __builtin_isgreaterequal(__type(__x), __type(__y)); | |
1294 | } | |
3115f94f | 1295 | #endif |
77fd1c1d | 1296 | |
3115f94f | 1297 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1298 | constexpr bool |
77fd1c1d PC |
1299 | isless(float __x, float __y) |
1300 | { return __builtin_isless(__x, __y); } | |
1301 | ||
fa459900 | 1302 | constexpr bool |
77fd1c1d PC |
1303 | isless(double __x, double __y) |
1304 | { return __builtin_isless(__x, __y); } | |
1305 | ||
fa459900 | 1306 | constexpr bool |
77fd1c1d PC |
1307 | isless(long double __x, long double __y) |
1308 | { return __builtin_isless(__x, __y); } | |
ef3a7506 | 1309 | #endif |
77fd1c1d | 1310 | |
3115f94f | 1311 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1312 | template<typename _Tp, typename _Up> |
fa459900 | 1313 | constexpr typename |
77fd1c1d PC |
1314 | __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value |
1315 | && __is_arithmetic<_Up>::__value), bool>::__type | |
1316 | isless(_Tp __x, _Up __y) | |
1317 | { | |
1318 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1319 | return __builtin_isless(__type(__x), __type(__y)); | |
1320 | } | |
3115f94f | 1321 | #endif |
77fd1c1d | 1322 | |
3115f94f | 1323 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1324 | constexpr bool |
77fd1c1d PC |
1325 | islessequal(float __x, float __y) |
1326 | { return __builtin_islessequal(__x, __y); } | |
1327 | ||
fa459900 | 1328 | constexpr bool |
77fd1c1d PC |
1329 | islessequal(double __x, double __y) |
1330 | { return __builtin_islessequal(__x, __y); } | |
1331 | ||
fa459900 | 1332 | constexpr bool |
77fd1c1d PC |
1333 | islessequal(long double __x, long double __y) |
1334 | { return __builtin_islessequal(__x, __y); } | |
ef3a7506 | 1335 | #endif |
77fd1c1d | 1336 | |
3115f94f | 1337 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1338 | template<typename _Tp, typename _Up> |
fa459900 | 1339 | constexpr typename |
77fd1c1d PC |
1340 | __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value |
1341 | && __is_arithmetic<_Up>::__value), bool>::__type | |
1342 | islessequal(_Tp __x, _Up __y) | |
1343 | { | |
1344 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1345 | return __builtin_islessequal(__type(__x), __type(__y)); | |
1346 | } | |
3115f94f | 1347 | #endif |
77fd1c1d | 1348 | |
3115f94f | 1349 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1350 | constexpr bool |
77fd1c1d PC |
1351 | islessgreater(float __x, float __y) |
1352 | { return __builtin_islessgreater(__x, __y); } | |
1353 | ||
fa459900 | 1354 | constexpr bool |
77fd1c1d PC |
1355 | islessgreater(double __x, double __y) |
1356 | { return __builtin_islessgreater(__x, __y); } | |
1357 | ||
fa459900 | 1358 | constexpr bool |
77fd1c1d PC |
1359 | islessgreater(long double __x, long double __y) |
1360 | { return __builtin_islessgreater(__x, __y); } | |
ef3a7506 | 1361 | #endif |
77fd1c1d | 1362 | |
3115f94f | 1363 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1364 | template<typename _Tp, typename _Up> |
fa459900 | 1365 | constexpr typename |
77fd1c1d PC |
1366 | __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value |
1367 | && __is_arithmetic<_Up>::__value), bool>::__type | |
1368 | islessgreater(_Tp __x, _Up __y) | |
1369 | { | |
1370 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1371 | return __builtin_islessgreater(__type(__x), __type(__y)); | |
1372 | } | |
3115f94f | 1373 | #endif |
77fd1c1d | 1374 | |
3115f94f | 1375 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 1376 | constexpr bool |
77fd1c1d PC |
1377 | isunordered(float __x, float __y) |
1378 | { return __builtin_isunordered(__x, __y); } | |
1379 | ||
fa459900 | 1380 | constexpr bool |
77fd1c1d PC |
1381 | isunordered(double __x, double __y) |
1382 | { return __builtin_isunordered(__x, __y); } | |
1383 | ||
fa459900 | 1384 | constexpr bool |
77fd1c1d PC |
1385 | isunordered(long double __x, long double __y) |
1386 | { return __builtin_isunordered(__x, __y); } | |
ef3a7506 | 1387 | #endif |
77fd1c1d | 1388 | |
3115f94f | 1389 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
77fd1c1d | 1390 | template<typename _Tp, typename _Up> |
fa459900 | 1391 | constexpr typename |
77fd1c1d PC |
1392 | __gnu_cxx::__enable_if<(__is_arithmetic<_Tp>::__value |
1393 | && __is_arithmetic<_Up>::__value), bool>::__type | |
1394 | isunordered(_Tp __x, _Up __y) | |
1395 | { | |
1396 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
1397 | return __builtin_isunordered(__type(__x), __type(__y)); | |
1398 | } | |
3115f94f | 1399 | #endif |
77fd1c1d PC |
1400 | |
1401 | #else | |
1402 | ||
af13a7a6 | 1403 | template<typename _Tp> |
0e7edcd5 PC |
1404 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1405 | int>::__type | |
1406 | fpclassify(_Tp __f) | |
1407 | { | |
1408 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
ebd15f80 PC |
1409 | return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, |
1410 | FP_SUBNORMAL, FP_ZERO, __type(__f)); | |
0e7edcd5 | 1411 | } |
af13a7a6 BK |
1412 | |
1413 | template<typename _Tp> | |
0e7edcd5 PC |
1414 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1415 | int>::__type | |
1416 | isfinite(_Tp __f) | |
1417 | { | |
1418 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1419 | return __builtin_isfinite(__type(__f)); | |
1420 | } | |
af13a7a6 BK |
1421 | |
1422 | template<typename _Tp> | |
0e7edcd5 PC |
1423 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1424 | int>::__type | |
1425 | isinf(_Tp __f) | |
1426 | { | |
1427 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1428 | return __builtin_isinf(__type(__f)); | |
1429 | } | |
af13a7a6 BK |
1430 | |
1431 | template<typename _Tp> | |
0e7edcd5 PC |
1432 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1433 | int>::__type | |
1434 | isnan(_Tp __f) | |
1435 | { | |
1436 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1437 | return __builtin_isnan(__type(__f)); | |
1438 | } | |
af13a7a6 BK |
1439 | |
1440 | template<typename _Tp> | |
0e7edcd5 PC |
1441 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1442 | int>::__type | |
1443 | isnormal(_Tp __f) | |
1444 | { | |
1445 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1446 | return __builtin_isnormal(__type(__f)); | |
1447 | } | |
af13a7a6 BK |
1448 | |
1449 | template<typename _Tp> | |
0e7edcd5 PC |
1450 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1451 | int>::__type | |
1452 | signbit(_Tp __f) | |
1453 | { | |
1454 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1455 | return __builtin_signbit(__type(__f)); | |
1456 | } | |
af13a7a6 BK |
1457 | |
1458 | template<typename _Tp> | |
0e7edcd5 PC |
1459 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1460 | int>::__type | |
af13a7a6 | 1461 | isgreater(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
1462 | { |
1463 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1464 | return __builtin_isgreater(__type(__f1), __type(__f2)); | |
1465 | } | |
af13a7a6 BK |
1466 | |
1467 | template<typename _Tp> | |
0e7edcd5 PC |
1468 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1469 | int>::__type | |
af13a7a6 | 1470 | isgreaterequal(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
1471 | { |
1472 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1473 | return __builtin_isgreaterequal(__type(__f1), __type(__f2)); | |
1474 | } | |
af13a7a6 BK |
1475 | |
1476 | template<typename _Tp> | |
0e7edcd5 PC |
1477 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1478 | int>::__type | |
af13a7a6 | 1479 | isless(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
1480 | { |
1481 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1482 | return __builtin_isless(__type(__f1), __type(__f2)); | |
1483 | } | |
af13a7a6 BK |
1484 | |
1485 | template<typename _Tp> | |
0e7edcd5 PC |
1486 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1487 | int>::__type | |
af13a7a6 | 1488 | islessequal(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
1489 | { |
1490 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1491 | return __builtin_islessequal(__type(__f1), __type(__f2)); | |
1492 | } | |
af13a7a6 BK |
1493 | |
1494 | template<typename _Tp> | |
0e7edcd5 PC |
1495 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1496 | int>::__type | |
af13a7a6 | 1497 | islessgreater(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
1498 | { |
1499 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1500 | return __builtin_islessgreater(__type(__f1), __type(__f2)); | |
1501 | } | |
af13a7a6 BK |
1502 | |
1503 | template<typename _Tp> | |
0e7edcd5 PC |
1504 | inline typename __gnu_cxx::__enable_if<__is_arithmetic<_Tp>::__value, |
1505 | int>::__type | |
af13a7a6 | 1506 | isunordered(_Tp __f1, _Tp __f2) |
0e7edcd5 PC |
1507 | { |
1508 | typedef typename __gnu_cxx::__promote<_Tp>::__type __type; | |
1509 | return __builtin_isunordered(__type(__f1), __type(__f2)); | |
1510 | } | |
af13a7a6 | 1511 | |
4a15d842 | 1512 | #endif // C++11 |
af13a7a6 | 1513 | |
a23225fb JJ |
1514 | #ifdef __STDCPP_FLOAT16_T__ |
1515 | constexpr int | |
1516 | fpclassify(_Float16 __x) | |
1517 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1518 | FP_SUBNORMAL, FP_ZERO, __x); } | |
53dc5044 | 1519 | |
a23225fb JJ |
1520 | constexpr bool |
1521 | isfinite(_Float16 __x) | |
1522 | { return __builtin_isfinite(__x); } | |
53dc5044 | 1523 | |
a23225fb JJ |
1524 | constexpr bool |
1525 | isinf(_Float16 __x) | |
1526 | { return __builtin_isinf(__x); } | |
1527 | ||
1528 | constexpr bool | |
1529 | isnan(_Float16 __x) | |
1530 | { return __builtin_isnan(__x); } | |
1531 | ||
1532 | constexpr bool | |
1533 | isnormal(_Float16 __x) | |
1534 | { return __builtin_isnormal(__x); } | |
1535 | ||
1536 | constexpr bool | |
1537 | signbit(_Float16 __x) | |
1538 | { return __builtin_signbit(__x); } | |
1539 | ||
1540 | constexpr bool | |
1541 | isgreater(_Float16 __x, _Float16 __y) | |
1542 | { return __builtin_isgreater(__x, __y); } | |
1543 | ||
1544 | constexpr bool | |
1545 | isgreaterequal(_Float16 __x, _Float16 __y) | |
1546 | { return __builtin_isgreaterequal(__x, __y); } | |
1547 | ||
1548 | constexpr bool | |
1549 | isless(_Float16 __x, _Float16 __y) | |
1550 | { return __builtin_isless(__x, __y); } | |
1551 | ||
1552 | constexpr bool | |
1553 | islessequal(_Float16 __x, _Float16 __y) | |
1554 | { return __builtin_islessequal(__x, __y); } | |
1555 | ||
1556 | constexpr bool | |
1557 | islessgreater(_Float16 __x, _Float16 __y) | |
1558 | { return __builtin_islessgreater(__x, __y); } | |
1559 | ||
1560 | constexpr bool | |
1561 | isunordered(_Float16 __x, _Float16 __y) | |
1562 | { return __builtin_isunordered(__x, __y); } | |
a7765de8 | 1563 | #endif |
a23225fb JJ |
1564 | |
1565 | #ifdef __STDCPP_FLOAT32_T__ | |
1566 | constexpr int | |
1567 | fpclassify(_Float32 __x) | |
1568 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1569 | FP_SUBNORMAL, FP_ZERO, __x); } | |
1570 | ||
1571 | constexpr bool | |
1572 | isfinite(_Float32 __x) | |
1573 | { return __builtin_isfinite(__x); } | |
1574 | ||
1575 | constexpr bool | |
1576 | isinf(_Float32 __x) | |
1577 | { return __builtin_isinf(__x); } | |
1578 | ||
1579 | constexpr bool | |
1580 | isnan(_Float32 __x) | |
1581 | { return __builtin_isnan(__x); } | |
1582 | ||
1583 | constexpr bool | |
1584 | isnormal(_Float32 __x) | |
1585 | { return __builtin_isnormal(__x); } | |
1586 | ||
1587 | constexpr bool | |
1588 | signbit(_Float32 __x) | |
1589 | { return __builtin_signbit(__x); } | |
1590 | ||
1591 | constexpr bool | |
1592 | isgreater(_Float32 __x, _Float32 __y) | |
1593 | { return __builtin_isgreater(__x, __y); } | |
1594 | ||
1595 | constexpr bool | |
1596 | isgreaterequal(_Float32 __x, _Float32 __y) | |
1597 | { return __builtin_isgreaterequal(__x, __y); } | |
1598 | ||
1599 | constexpr bool | |
1600 | isless(_Float32 __x, _Float32 __y) | |
1601 | { return __builtin_isless(__x, __y); } | |
1602 | ||
1603 | constexpr bool | |
1604 | islessequal(_Float32 __x, _Float32 __y) | |
1605 | { return __builtin_islessequal(__x, __y); } | |
1606 | ||
1607 | constexpr bool | |
1608 | islessgreater(_Float32 __x, _Float32 __y) | |
1609 | { return __builtin_islessgreater(__x, __y); } | |
1610 | ||
1611 | constexpr bool | |
1612 | isunordered(_Float32 __x, _Float32 __y) | |
1613 | { return __builtin_isunordered(__x, __y); } | |
1614 | #endif | |
1615 | ||
1616 | #ifdef __STDCPP_FLOAT64_T__ | |
1617 | constexpr int | |
1618 | fpclassify(_Float64 __x) | |
1619 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1620 | FP_SUBNORMAL, FP_ZERO, __x); } | |
1621 | ||
1622 | constexpr bool | |
1623 | isfinite(_Float64 __x) | |
1624 | { return __builtin_isfinite(__x); } | |
1625 | ||
1626 | constexpr bool | |
1627 | isinf(_Float64 __x) | |
1628 | { return __builtin_isinf(__x); } | |
1629 | ||
1630 | constexpr bool | |
1631 | isnan(_Float64 __x) | |
1632 | { return __builtin_isnan(__x); } | |
1633 | ||
1634 | constexpr bool | |
1635 | isnormal(_Float64 __x) | |
1636 | { return __builtin_isnormal(__x); } | |
1637 | ||
1638 | constexpr bool | |
1639 | signbit(_Float64 __x) | |
1640 | { return __builtin_signbit(__x); } | |
1641 | ||
1642 | constexpr bool | |
1643 | isgreater(_Float64 __x, _Float64 __y) | |
1644 | { return __builtin_isgreater(__x, __y); } | |
1645 | ||
1646 | constexpr bool | |
1647 | isgreaterequal(_Float64 __x, _Float64 __y) | |
1648 | { return __builtin_isgreaterequal(__x, __y); } | |
1649 | ||
1650 | constexpr bool | |
1651 | isless(_Float64 __x, _Float64 __y) | |
1652 | { return __builtin_isless(__x, __y); } | |
1653 | ||
1654 | constexpr bool | |
1655 | islessequal(_Float64 __x, _Float64 __y) | |
1656 | { return __builtin_islessequal(__x, __y); } | |
1657 | ||
1658 | constexpr bool | |
1659 | islessgreater(_Float64 __x, _Float64 __y) | |
1660 | { return __builtin_islessgreater(__x, __y); } | |
1661 | ||
1662 | constexpr bool | |
1663 | isunordered(_Float64 __x, _Float64 __y) | |
1664 | { return __builtin_isunordered(__x, __y); } | |
1665 | #endif | |
1666 | ||
1667 | #ifdef __STDCPP_FLOAT128_T__ | |
1668 | constexpr int | |
1669 | fpclassify(_Float128 __x) | |
1670 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1671 | FP_SUBNORMAL, FP_ZERO, __x); } | |
1672 | ||
1673 | constexpr bool | |
1674 | isfinite(_Float128 __x) | |
1675 | { return __builtin_isfinite(__x); } | |
1676 | ||
1677 | constexpr bool | |
1678 | isinf(_Float128 __x) | |
1679 | { return __builtin_isinf(__x); } | |
1680 | ||
1681 | constexpr bool | |
1682 | isnan(_Float128 __x) | |
1683 | { return __builtin_isnan(__x); } | |
1684 | ||
1685 | constexpr bool | |
1686 | isnormal(_Float128 __x) | |
1687 | { return __builtin_isnormal(__x); } | |
1688 | ||
1689 | constexpr bool | |
1690 | signbit(_Float128 __x) | |
1691 | { return __builtin_signbit(__x); } | |
1692 | ||
1693 | constexpr bool | |
1694 | isgreater(_Float128 __x, _Float128 __y) | |
1695 | { return __builtin_isgreater(__x, __y); } | |
1696 | ||
1697 | constexpr bool | |
1698 | isgreaterequal(_Float128 __x, _Float128 __y) | |
1699 | { return __builtin_isgreaterequal(__x, __y); } | |
1700 | ||
1701 | constexpr bool | |
1702 | isless(_Float128 __x, _Float128 __y) | |
1703 | { return __builtin_isless(__x, __y); } | |
1704 | ||
1705 | constexpr bool | |
1706 | islessequal(_Float128 __x, _Float128 __y) | |
1707 | { return __builtin_islessequal(__x, __y); } | |
1708 | ||
1709 | constexpr bool | |
1710 | islessgreater(_Float128 __x, _Float128 __y) | |
1711 | { return __builtin_islessgreater(__x, __y); } | |
1712 | ||
1713 | constexpr bool | |
1714 | isunordered(_Float128 __x, _Float128 __y) | |
1715 | { return __builtin_isunordered(__x, __y); } | |
1716 | #endif | |
1717 | ||
1718 | #ifdef __STDCPP_BFLOAT16_T__ | |
1719 | constexpr int | |
1720 | fpclassify(__gnu_cxx::__bfloat16_t __x) | |
1721 | { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, | |
1722 | FP_SUBNORMAL, FP_ZERO, __x); } | |
1723 | ||
1724 | constexpr bool | |
1725 | isfinite(__gnu_cxx::__bfloat16_t __x) | |
1726 | { return __builtin_isfinite(__x); } | |
1727 | ||
1728 | constexpr bool | |
1729 | isinf(__gnu_cxx::__bfloat16_t __x) | |
1730 | { return __builtin_isinf(__x); } | |
1731 | ||
1732 | constexpr bool | |
1733 | isnan(__gnu_cxx::__bfloat16_t __x) | |
1734 | { return __builtin_isnan(__x); } | |
1735 | ||
1736 | constexpr bool | |
1737 | isnormal(__gnu_cxx::__bfloat16_t __x) | |
1738 | { return __builtin_isnormal(__x); } | |
1739 | ||
1740 | constexpr bool | |
1741 | signbit(__gnu_cxx::__bfloat16_t __x) | |
1742 | { return __builtin_signbit(__x); } | |
1743 | ||
1744 | constexpr bool | |
1745 | isgreater(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1746 | { return __builtin_isgreater(__x, __y); } | |
1747 | ||
1748 | constexpr bool | |
1749 | isgreaterequal(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1750 | { return __builtin_isgreaterequal(__x, __y); } | |
1751 | ||
1752 | constexpr bool | |
1753 | isless(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1754 | { return __builtin_isless(__x, __y); } | |
1755 | ||
1756 | constexpr bool | |
1757 | islessequal(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1758 | { return __builtin_islessequal(__x, __y); } | |
1759 | ||
1760 | constexpr bool | |
1761 | islessgreater(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1762 | { return __builtin_islessgreater(__x, __y); } | |
1763 | ||
1764 | constexpr bool | |
1765 | isunordered(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
1766 | { return __builtin_isunordered(__x, __y); } | |
1767 | #endif | |
1768 | ||
1769 | #endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */ | |
1770 | #endif /* _GLIBCXX_USE_C99_MATH */ | |
1771 | ||
1772 | #if __cplusplus >= 201103L | |
1773 | ||
0b880466 NS |
1774 | #undef acosf |
1775 | #undef acosl | |
1776 | #undef asinf | |
1777 | #undef asinl | |
1778 | #undef atanf | |
1779 | #undef atanl | |
1780 | #undef atan2f | |
1781 | #undef atan2l | |
1782 | #undef ceilf | |
1783 | #undef ceill | |
1784 | #undef cosf | |
1785 | #undef cosl | |
1786 | #undef coshf | |
1787 | #undef coshl | |
1788 | #undef expf | |
1789 | #undef expl | |
1790 | #undef fabsf | |
1791 | #undef fabsl | |
1792 | #undef floorf | |
1793 | #undef floorl | |
1794 | #undef fmodf | |
1795 | #undef fmodl | |
1796 | #undef frexpf | |
1797 | #undef frexpl | |
1798 | #undef ldexpf | |
1799 | #undef ldexpl | |
1800 | #undef logf | |
1801 | #undef logl | |
1802 | #undef log10f | |
1803 | #undef log10l | |
1804 | #undef modff | |
1805 | #undef modfl | |
1806 | #undef powf | |
1807 | #undef powl | |
1808 | #undef sinf | |
1809 | #undef sinl | |
1810 | #undef sinhf | |
1811 | #undef sinhl | |
1812 | #undef sqrtf | |
1813 | #undef sqrtl | |
1814 | #undef tanf | |
1815 | #undef tanl | |
1816 | #undef tanhf | |
1817 | #undef tanhl | |
1818 | ||
1819 | #ifdef _GLIBCXX_HAVE_ACOSF | |
1820 | using ::acosf; | |
1821 | #endif | |
1822 | #ifdef _GLIBCXX_HAVE_ACOSL | |
1823 | using ::acosl; | |
1824 | #endif | |
1825 | ||
1826 | #ifdef _GLIBCXX_HAVE_ASINF | |
1827 | using ::asinf; | |
1828 | #endif | |
1829 | #ifdef _GLIBCXX_HAVE_ASINL | |
1830 | using ::asinl; | |
1831 | #endif | |
1832 | ||
1833 | #ifdef _GLIBCXX_HAVE_ATANF | |
1834 | using ::atanf; | |
1835 | #endif | |
1836 | #ifdef _GLIBCXX_HAVE_ATANL | |
1837 | using ::atanl; | |
1838 | #endif | |
1839 | ||
1840 | #ifdef _GLIBCXX_HAVE_ATAN2F | |
1841 | using ::atan2f; | |
1842 | #endif | |
1843 | #ifdef _GLIBCXX_HAVE_ATAN2L | |
1844 | using ::atan2l; | |
1845 | #endif | |
1846 | ||
1847 | #ifdef _GLIBCXX_HAVE_CEILF | |
1848 | using ::ceilf; | |
1849 | #endif | |
1850 | #ifdef _GLIBCXX_HAVE_CEILL | |
1851 | using ::ceill; | |
1852 | #endif | |
1853 | ||
1854 | #ifdef _GLIBCXX_HAVE_COSF | |
1855 | using ::cosf; | |
1856 | #endif | |
1857 | #ifdef _GLIBCXX_HAVE_COSL | |
1858 | using ::cosl; | |
1859 | #endif | |
1860 | ||
1861 | #ifdef _GLIBCXX_HAVE_COSHF | |
1862 | using ::coshf; | |
1863 | #endif | |
1864 | #ifdef _GLIBCXX_HAVE_COSHL | |
1865 | using ::coshl; | |
1866 | #endif | |
1867 | ||
1868 | #ifdef _GLIBCXX_HAVE_EXPF | |
1869 | using ::expf; | |
1870 | #endif | |
1871 | #ifdef _GLIBCXX_HAVE_EXPL | |
1872 | using ::expl; | |
1873 | #endif | |
1874 | ||
1875 | #ifdef _GLIBCXX_HAVE_FABSF | |
1876 | using ::fabsf; | |
1877 | #endif | |
1878 | #ifdef _GLIBCXX_HAVE_FABSL | |
1879 | using ::fabsl; | |
1880 | #endif | |
1881 | ||
1882 | #ifdef _GLIBCXX_HAVE_FLOORF | |
1883 | using ::floorf; | |
1884 | #endif | |
1885 | #ifdef _GLIBCXX_HAVE_FLOORL | |
1886 | using ::floorl; | |
1887 | #endif | |
1888 | ||
1889 | #ifdef _GLIBCXX_HAVE_FMODF | |
1890 | using ::fmodf; | |
1891 | #endif | |
1892 | #ifdef _GLIBCXX_HAVE_FMODL | |
1893 | using ::fmodl; | |
1894 | #endif | |
1895 | ||
1896 | #ifdef _GLIBCXX_HAVE_FREXPF | |
1897 | using ::frexpf; | |
1898 | #endif | |
1899 | #ifdef _GLIBCXX_HAVE_FREXPL | |
1900 | using ::frexpl; | |
1901 | #endif | |
1902 | ||
1903 | #ifdef _GLIBCXX_HAVE_LDEXPF | |
1904 | using ::ldexpf; | |
1905 | #endif | |
1906 | #ifdef _GLIBCXX_HAVE_LDEXPL | |
1907 | using ::ldexpl; | |
1908 | #endif | |
1909 | ||
1910 | #ifdef _GLIBCXX_HAVE_LOGF | |
1911 | using ::logf; | |
1912 | #endif | |
1913 | #ifdef _GLIBCXX_HAVE_LOGL | |
1914 | using ::logl; | |
1915 | #endif | |
1916 | ||
1917 | #ifdef _GLIBCXX_HAVE_LOG10F | |
1918 | using ::log10f; | |
1919 | #endif | |
1920 | #ifdef _GLIBCXX_HAVE_LOG10L | |
1921 | using ::log10l; | |
1922 | #endif | |
1923 | ||
1924 | #ifdef _GLIBCXX_HAVE_MODFF | |
1925 | using ::modff; | |
1926 | #endif | |
1927 | #ifdef _GLIBCXX_HAVE_MODFL | |
1928 | using ::modfl; | |
1929 | #endif | |
1930 | ||
1931 | #ifdef _GLIBCXX_HAVE_POWF | |
1932 | using ::powf; | |
1933 | #endif | |
1934 | #ifdef _GLIBCXX_HAVE_POWL | |
1935 | using ::powl; | |
1936 | #endif | |
1937 | ||
1938 | #ifdef _GLIBCXX_HAVE_SINF | |
1939 | using ::sinf; | |
1940 | #endif | |
1941 | #ifdef _GLIBCXX_HAVE_SINL | |
1942 | using ::sinl; | |
1943 | #endif | |
1944 | ||
1945 | #ifdef _GLIBCXX_HAVE_SINHF | |
1946 | using ::sinhf; | |
1947 | #endif | |
1948 | #ifdef _GLIBCXX_HAVE_SINHL | |
1949 | using ::sinhl; | |
1950 | #endif | |
1951 | ||
1952 | #ifdef _GLIBCXX_HAVE_SQRTF | |
1953 | using ::sqrtf; | |
1954 | #endif | |
1955 | #ifdef _GLIBCXX_HAVE_SQRTL | |
1956 | using ::sqrtl; | |
1957 | #endif | |
1958 | ||
1959 | #ifdef _GLIBCXX_HAVE_TANF | |
1960 | using ::tanf; | |
1961 | #endif | |
1962 | #ifdef _GLIBCXX_HAVE_TANL | |
1963 | using ::tanl; | |
1964 | #endif | |
1965 | ||
1966 | #ifdef _GLIBCXX_HAVE_TANHF | |
1967 | using ::tanhf; | |
1968 | #endif | |
1969 | #ifdef _GLIBCXX_HAVE_TANHL | |
1970 | using ::tanhl; | |
1971 | #endif | |
1972 | ||
1f378f6d | 1973 | #ifdef _GLIBCXX_USE_C99_MATH_FUNCS |
a23225fb JJ |
1974 | |
1975 | #undef acosh | |
1976 | #undef acoshf | |
1977 | #undef acoshl | |
1978 | #undef asinh | |
1979 | #undef asinhf | |
1980 | #undef asinhl | |
1981 | #undef atanh | |
1982 | #undef atanhf | |
1983 | #undef atanhl | |
1984 | #undef cbrt | |
1985 | #undef cbrtf | |
1986 | #undef cbrtl | |
1987 | #undef copysign | |
1988 | #undef copysignf | |
1989 | #undef copysignl | |
1990 | #undef erf | |
1991 | #undef erff | |
1992 | #undef erfl | |
1993 | #undef erfc | |
1994 | #undef erfcf | |
1995 | #undef erfcl | |
1996 | #undef exp2 | |
1997 | #undef exp2f | |
1998 | #undef exp2l | |
1999 | #undef expm1 | |
2000 | #undef expm1f | |
2001 | #undef expm1l | |
2002 | #undef fdim | |
2003 | #undef fdimf | |
2004 | #undef fdiml | |
2005 | #undef fma | |
2006 | #undef fmaf | |
2007 | #undef fmal | |
2008 | #undef fmax | |
2009 | #undef fmaxf | |
2010 | #undef fmaxl | |
2011 | #undef fmin | |
2012 | #undef fminf | |
2013 | #undef fminl | |
2014 | #undef hypot | |
2015 | #undef hypotf | |
2016 | #undef hypotl | |
2017 | #undef ilogb | |
2018 | #undef ilogbf | |
2019 | #undef ilogbl | |
2020 | #undef lgamma | |
2021 | #undef lgammaf | |
2022 | #undef lgammal | |
2023 | #ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS | |
2024 | #undef llrint | |
2025 | #undef llrintf | |
2026 | #undef llrintl | |
2027 | #undef llround | |
2028 | #undef llroundf | |
2029 | #undef llroundl | |
2030 | #endif | |
2031 | #undef log1p | |
2032 | #undef log1pf | |
2033 | #undef log1pl | |
2034 | #undef log2 | |
2035 | #undef log2f | |
2036 | #undef log2l | |
2037 | #undef logb | |
2038 | #undef logbf | |
2039 | #undef logbl | |
2040 | #undef lrint | |
2041 | #undef lrintf | |
2042 | #undef lrintl | |
2043 | #undef lround | |
2044 | #undef lroundf | |
2045 | #undef lroundl | |
53dc5044 PC |
2046 | #undef nan |
2047 | #undef nanf | |
2048 | #undef nanl | |
2049 | #undef nearbyint | |
2050 | #undef nearbyintf | |
2051 | #undef nearbyintl | |
2052 | #undef nextafter | |
2053 | #undef nextafterf | |
2054 | #undef nextafterl | |
2055 | #undef nexttoward | |
2056 | #undef nexttowardf | |
2057 | #undef nexttowardl | |
2058 | #undef remainder | |
2059 | #undef remainderf | |
2060 | #undef remainderl | |
2061 | #undef remquo | |
2062 | #undef remquof | |
2063 | #undef remquol | |
2064 | #undef rint | |
2065 | #undef rintf | |
2066 | #undef rintl | |
2067 | #undef round | |
2068 | #undef roundf | |
2069 | #undef roundl | |
2070 | #undef scalbln | |
2071 | #undef scalblnf | |
2072 | #undef scalblnl | |
2073 | #undef scalbn | |
2074 | #undef scalbnf | |
2075 | #undef scalbnl | |
2076 | #undef tgamma | |
2077 | #undef tgammaf | |
2078 | #undef tgammal | |
2079 | #undef trunc | |
2080 | #undef truncf | |
2081 | #undef truncl | |
2082 | ||
49f59826 | 2083 | #ifdef _GLIBCXX_HAVE_C99_FLT_EVAL_TYPES |
53dc5044 PC |
2084 | // types |
2085 | using ::double_t; | |
2086 | using ::float_t; | |
49f59826 | 2087 | #endif |
53dc5044 PC |
2088 | |
2089 | // functions | |
2090 | using ::acosh; | |
2091 | using ::acoshf; | |
2092 | using ::acoshl; | |
2093 | ||
2094 | using ::asinh; | |
2095 | using ::asinhf; | |
2096 | using ::asinhl; | |
2097 | ||
2098 | using ::atanh; | |
2099 | using ::atanhf; | |
2100 | using ::atanhl; | |
2101 | ||
2102 | using ::cbrt; | |
2103 | using ::cbrtf; | |
2104 | using ::cbrtl; | |
2105 | ||
2106 | using ::copysign; | |
2107 | using ::copysignf; | |
2108 | using ::copysignl; | |
2109 | ||
2110 | using ::erf; | |
2111 | using ::erff; | |
2112 | using ::erfl; | |
2113 | ||
2114 | using ::erfc; | |
2115 | using ::erfcf; | |
2116 | using ::erfcl; | |
2117 | ||
2118 | using ::exp2; | |
2119 | using ::exp2f; | |
2120 | using ::exp2l; | |
2121 | ||
2122 | using ::expm1; | |
2123 | using ::expm1f; | |
2124 | using ::expm1l; | |
2125 | ||
2126 | using ::fdim; | |
2127 | using ::fdimf; | |
2128 | using ::fdiml; | |
2129 | ||
2130 | using ::fma; | |
2131 | using ::fmaf; | |
2132 | using ::fmal; | |
2133 | ||
2134 | using ::fmax; | |
2135 | using ::fmaxf; | |
2136 | using ::fmaxl; | |
2137 | ||
2138 | using ::fmin; | |
2139 | using ::fminf; | |
2140 | using ::fminl; | |
2141 | ||
2142 | using ::hypot; | |
2143 | using ::hypotf; | |
2144 | using ::hypotl; | |
2145 | ||
2146 | using ::ilogb; | |
2147 | using ::ilogbf; | |
2148 | using ::ilogbl; | |
2149 | ||
2150 | using ::lgamma; | |
2151 | using ::lgammaf; | |
2152 | using ::lgammal; | |
2153 | ||
a7765de8 | 2154 | #ifndef _GLIBCXX_NO_C99_ROUNDING_FUNCS |
53dc5044 PC |
2155 | using ::llrint; |
2156 | using ::llrintf; | |
2157 | using ::llrintl; | |
2158 | ||
2159 | using ::llround; | |
2160 | using ::llroundf; | |
2161 | using ::llroundl; | |
a7765de8 | 2162 | #endif |
53dc5044 PC |
2163 | |
2164 | using ::log1p; | |
2165 | using ::log1pf; | |
2166 | using ::log1pl; | |
2167 | ||
2168 | using ::log2; | |
2169 | using ::log2f; | |
2170 | using ::log2l; | |
2171 | ||
2172 | using ::logb; | |
2173 | using ::logbf; | |
2174 | using ::logbl; | |
2175 | ||
2176 | using ::lrint; | |
2177 | using ::lrintf; | |
2178 | using ::lrintl; | |
2179 | ||
2180 | using ::lround; | |
2181 | using ::lroundf; | |
2182 | using ::lroundl; | |
2183 | ||
2184 | using ::nan; | |
2185 | using ::nanf; | |
2186 | using ::nanl; | |
2187 | ||
2188 | using ::nearbyint; | |
2189 | using ::nearbyintf; | |
2190 | using ::nearbyintl; | |
2191 | ||
2192 | using ::nextafter; | |
2193 | using ::nextafterf; | |
2194 | using ::nextafterl; | |
2195 | ||
2196 | using ::nexttoward; | |
2197 | using ::nexttowardf; | |
2198 | using ::nexttowardl; | |
2199 | ||
2200 | using ::remainder; | |
2201 | using ::remainderf; | |
2202 | using ::remainderl; | |
2203 | ||
2204 | using ::remquo; | |
2205 | using ::remquof; | |
2206 | using ::remquol; | |
2207 | ||
2208 | using ::rint; | |
2209 | using ::rintf; | |
2210 | using ::rintl; | |
2211 | ||
2212 | using ::round; | |
2213 | using ::roundf; | |
2214 | using ::roundl; | |
2215 | ||
2216 | using ::scalbln; | |
2217 | using ::scalblnf; | |
2218 | using ::scalblnl; | |
2219 | ||
2220 | using ::scalbn; | |
2221 | using ::scalbnf; | |
2222 | using ::scalbnl; | |
2223 | ||
2224 | using ::tgamma; | |
2225 | using ::tgammaf; | |
2226 | using ::tgammal; | |
2227 | ||
2228 | using ::trunc; | |
2229 | using ::truncf; | |
2230 | using ::truncl; | |
2231 | ||
298cee01 | 2232 | /// Additional overloads. |
3115f94f | 2233 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2234 | constexpr float |
53dc5044 PC |
2235 | acosh(float __x) |
2236 | { return __builtin_acoshf(__x); } | |
2237 | ||
fa459900 | 2238 | constexpr long double |
53dc5044 PC |
2239 | acosh(long double __x) |
2240 | { return __builtin_acoshl(__x); } | |
ef3a7506 | 2241 | #endif |
53dc5044 | 2242 | |
3115f94f | 2243 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2244 | template<typename _Tp> |
fa459900 PC |
2245 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2246 | double>::__type | |
53dc5044 | 2247 | acosh(_Tp __x) |
b04fa738 | 2248 | { return __builtin_acosh(__x); } |
3115f94f | 2249 | #endif |
53dc5044 | 2250 | |
3115f94f | 2251 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2252 | constexpr float |
53dc5044 PC |
2253 | asinh(float __x) |
2254 | { return __builtin_asinhf(__x); } | |
2255 | ||
fa459900 | 2256 | constexpr long double |
53dc5044 PC |
2257 | asinh(long double __x) |
2258 | { return __builtin_asinhl(__x); } | |
ef3a7506 | 2259 | #endif |
53dc5044 | 2260 | |
3115f94f | 2261 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2262 | template<typename _Tp> |
fa459900 PC |
2263 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2264 | double>::__type | |
53dc5044 | 2265 | asinh(_Tp __x) |
b04fa738 | 2266 | { return __builtin_asinh(__x); } |
3115f94f | 2267 | #endif |
53dc5044 | 2268 | |
3115f94f | 2269 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2270 | constexpr float |
53dc5044 PC |
2271 | atanh(float __x) |
2272 | { return __builtin_atanhf(__x); } | |
2273 | ||
fa459900 | 2274 | constexpr long double |
53dc5044 PC |
2275 | atanh(long double __x) |
2276 | { return __builtin_atanhl(__x); } | |
ef3a7506 | 2277 | #endif |
53dc5044 | 2278 | |
3115f94f | 2279 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2280 | template<typename _Tp> |
fa459900 PC |
2281 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2282 | double>::__type | |
53dc5044 | 2283 | atanh(_Tp __x) |
b04fa738 | 2284 | { return __builtin_atanh(__x); } |
3115f94f | 2285 | #endif |
53dc5044 | 2286 | |
3115f94f | 2287 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2288 | constexpr float |
53dc5044 PC |
2289 | cbrt(float __x) |
2290 | { return __builtin_cbrtf(__x); } | |
2291 | ||
fa459900 | 2292 | constexpr long double |
53dc5044 PC |
2293 | cbrt(long double __x) |
2294 | { return __builtin_cbrtl(__x); } | |
ef3a7506 | 2295 | #endif |
53dc5044 | 2296 | |
3115f94f | 2297 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2298 | template<typename _Tp> |
fa459900 PC |
2299 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2300 | double>::__type | |
53dc5044 | 2301 | cbrt(_Tp __x) |
b04fa738 | 2302 | { return __builtin_cbrt(__x); } |
3115f94f | 2303 | #endif |
53dc5044 | 2304 | |
3115f94f | 2305 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2306 | constexpr float |
53dc5044 PC |
2307 | copysign(float __x, float __y) |
2308 | { return __builtin_copysignf(__x, __y); } | |
2309 | ||
fa459900 | 2310 | constexpr long double |
53dc5044 PC |
2311 | copysign(long double __x, long double __y) |
2312 | { return __builtin_copysignl(__x, __y); } | |
ef3a7506 | 2313 | #endif |
53dc5044 | 2314 | |
3115f94f | 2315 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2316 | constexpr float |
53dc5044 PC |
2317 | erf(float __x) |
2318 | { return __builtin_erff(__x); } | |
2319 | ||
fa459900 | 2320 | constexpr long double |
53dc5044 PC |
2321 | erf(long double __x) |
2322 | { return __builtin_erfl(__x); } | |
ef3a7506 | 2323 | #endif |
53dc5044 | 2324 | |
3115f94f | 2325 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2326 | template<typename _Tp> |
fa459900 PC |
2327 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2328 | double>::__type | |
53dc5044 | 2329 | erf(_Tp __x) |
b04fa738 | 2330 | { return __builtin_erf(__x); } |
3115f94f | 2331 | #endif |
53dc5044 | 2332 | |
3115f94f | 2333 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2334 | constexpr float |
53dc5044 PC |
2335 | erfc(float __x) |
2336 | { return __builtin_erfcf(__x); } | |
2337 | ||
fa459900 | 2338 | constexpr long double |
53dc5044 PC |
2339 | erfc(long double __x) |
2340 | { return __builtin_erfcl(__x); } | |
ef3a7506 | 2341 | #endif |
53dc5044 | 2342 | |
3115f94f | 2343 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2344 | template<typename _Tp> |
fa459900 PC |
2345 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2346 | double>::__type | |
53dc5044 | 2347 | erfc(_Tp __x) |
b04fa738 | 2348 | { return __builtin_erfc(__x); } |
3115f94f | 2349 | #endif |
53dc5044 | 2350 | |
3115f94f | 2351 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2352 | constexpr float |
53dc5044 PC |
2353 | exp2(float __x) |
2354 | { return __builtin_exp2f(__x); } | |
2355 | ||
fa459900 | 2356 | constexpr long double |
53dc5044 PC |
2357 | exp2(long double __x) |
2358 | { return __builtin_exp2l(__x); } | |
ef3a7506 | 2359 | #endif |
53dc5044 | 2360 | |
3115f94f | 2361 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2362 | template<typename _Tp> |
fa459900 PC |
2363 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2364 | double>::__type | |
53dc5044 | 2365 | exp2(_Tp __x) |
b04fa738 | 2366 | { return __builtin_exp2(__x); } |
3115f94f | 2367 | #endif |
53dc5044 | 2368 | |
3115f94f | 2369 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2370 | constexpr float |
53dc5044 PC |
2371 | expm1(float __x) |
2372 | { return __builtin_expm1f(__x); } | |
2373 | ||
fa459900 | 2374 | constexpr long double |
53dc5044 PC |
2375 | expm1(long double __x) |
2376 | { return __builtin_expm1l(__x); } | |
ef3a7506 | 2377 | #endif |
53dc5044 | 2378 | |
3115f94f | 2379 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2380 | template<typename _Tp> |
fa459900 PC |
2381 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2382 | double>::__type | |
53dc5044 | 2383 | expm1(_Tp __x) |
b04fa738 | 2384 | { return __builtin_expm1(__x); } |
3115f94f | 2385 | #endif |
53dc5044 | 2386 | |
3115f94f | 2387 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2388 | constexpr float |
53dc5044 PC |
2389 | fdim(float __x, float __y) |
2390 | { return __builtin_fdimf(__x, __y); } | |
2391 | ||
fa459900 | 2392 | constexpr long double |
53dc5044 PC |
2393 | fdim(long double __x, long double __y) |
2394 | { return __builtin_fdiml(__x, __y); } | |
ef3a7506 | 2395 | #endif |
53dc5044 | 2396 | |
3115f94f | 2397 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2398 | constexpr float |
53dc5044 PC |
2399 | fma(float __x, float __y, float __z) |
2400 | { return __builtin_fmaf(__x, __y, __z); } | |
2401 | ||
fa459900 | 2402 | constexpr long double |
53dc5044 PC |
2403 | fma(long double __x, long double __y, long double __z) |
2404 | { return __builtin_fmal(__x, __y, __z); } | |
ef3a7506 | 2405 | #endif |
53dc5044 | 2406 | |
3115f94f | 2407 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2408 | constexpr float |
53dc5044 PC |
2409 | fmax(float __x, float __y) |
2410 | { return __builtin_fmaxf(__x, __y); } | |
2411 | ||
fa459900 | 2412 | constexpr long double |
53dc5044 PC |
2413 | fmax(long double __x, long double __y) |
2414 | { return __builtin_fmaxl(__x, __y); } | |
ef3a7506 | 2415 | #endif |
53dc5044 | 2416 | |
3115f94f | 2417 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2418 | constexpr float |
53dc5044 PC |
2419 | fmin(float __x, float __y) |
2420 | { return __builtin_fminf(__x, __y); } | |
2421 | ||
fa459900 | 2422 | constexpr long double |
53dc5044 PC |
2423 | fmin(long double __x, long double __y) |
2424 | { return __builtin_fminl(__x, __y); } | |
ef3a7506 | 2425 | #endif |
53dc5044 | 2426 | |
3115f94f | 2427 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2428 | constexpr float |
53dc5044 PC |
2429 | hypot(float __x, float __y) |
2430 | { return __builtin_hypotf(__x, __y); } | |
2431 | ||
fa459900 | 2432 | constexpr long double |
53dc5044 PC |
2433 | hypot(long double __x, long double __y) |
2434 | { return __builtin_hypotl(__x, __y); } | |
ef3a7506 | 2435 | #endif |
53dc5044 | 2436 | |
3115f94f | 2437 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2438 | constexpr int |
53dc5044 PC |
2439 | ilogb(float __x) |
2440 | { return __builtin_ilogbf(__x); } | |
2441 | ||
fa459900 | 2442 | constexpr int |
53dc5044 PC |
2443 | ilogb(long double __x) |
2444 | { return __builtin_ilogbl(__x); } | |
ef3a7506 | 2445 | #endif |
53dc5044 | 2446 | |
3115f94f | 2447 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2448 | template<typename _Tp> |
fa459900 PC |
2449 | constexpr |
2450 | typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, | |
2451 | int>::__type | |
53dc5044 | 2452 | ilogb(_Tp __x) |
b04fa738 | 2453 | { return __builtin_ilogb(__x); } |
3115f94f | 2454 | #endif |
53dc5044 | 2455 | |
3115f94f | 2456 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2457 | constexpr float |
53dc5044 PC |
2458 | lgamma(float __x) |
2459 | { return __builtin_lgammaf(__x); } | |
2460 | ||
fa459900 | 2461 | constexpr long double |
53dc5044 PC |
2462 | lgamma(long double __x) |
2463 | { return __builtin_lgammal(__x); } | |
ef3a7506 | 2464 | #endif |
53dc5044 | 2465 | |
3115f94f | 2466 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2467 | template<typename _Tp> |
fa459900 PC |
2468 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2469 | double>::__type | |
53dc5044 | 2470 | lgamma(_Tp __x) |
b04fa738 | 2471 | { return __builtin_lgamma(__x); } |
3115f94f | 2472 | #endif |
53dc5044 | 2473 | |
3115f94f | 2474 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2475 | constexpr long long |
53dc5044 PC |
2476 | llrint(float __x) |
2477 | { return __builtin_llrintf(__x); } | |
2478 | ||
fa459900 | 2479 | constexpr long long |
53dc5044 PC |
2480 | llrint(long double __x) |
2481 | { return __builtin_llrintl(__x); } | |
ef3a7506 | 2482 | #endif |
53dc5044 | 2483 | |
3115f94f | 2484 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2485 | template<typename _Tp> |
fa459900 PC |
2486 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2487 | long long>::__type | |
53dc5044 | 2488 | llrint(_Tp __x) |
b04fa738 | 2489 | { return __builtin_llrint(__x); } |
3115f94f | 2490 | #endif |
53dc5044 | 2491 | |
3115f94f | 2492 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2493 | constexpr long long |
53dc5044 PC |
2494 | llround(float __x) |
2495 | { return __builtin_llroundf(__x); } | |
2496 | ||
fa459900 | 2497 | constexpr long long |
53dc5044 PC |
2498 | llround(long double __x) |
2499 | { return __builtin_llroundl(__x); } | |
ef3a7506 | 2500 | #endif |
53dc5044 | 2501 | |
3115f94f | 2502 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2503 | template<typename _Tp> |
fa459900 PC |
2504 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2505 | long long>::__type | |
53dc5044 | 2506 | llround(_Tp __x) |
b04fa738 | 2507 | { return __builtin_llround(__x); } |
3115f94f | 2508 | #endif |
53dc5044 | 2509 | |
3115f94f | 2510 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2511 | constexpr float |
53dc5044 PC |
2512 | log1p(float __x) |
2513 | { return __builtin_log1pf(__x); } | |
2514 | ||
fa459900 | 2515 | constexpr long double |
53dc5044 PC |
2516 | log1p(long double __x) |
2517 | { return __builtin_log1pl(__x); } | |
ef3a7506 | 2518 | #endif |
53dc5044 | 2519 | |
3115f94f | 2520 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2521 | template<typename _Tp> |
fa459900 PC |
2522 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2523 | double>::__type | |
53dc5044 | 2524 | log1p(_Tp __x) |
b04fa738 | 2525 | { return __builtin_log1p(__x); } |
3115f94f | 2526 | #endif |
53dc5044 | 2527 | |
3115f94f | 2528 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
53dc5044 | 2529 | // DR 568. |
fa459900 | 2530 | constexpr float |
53dc5044 PC |
2531 | log2(float __x) |
2532 | { return __builtin_log2f(__x); } | |
2533 | ||
fa459900 | 2534 | constexpr long double |
53dc5044 PC |
2535 | log2(long double __x) |
2536 | { return __builtin_log2l(__x); } | |
ef3a7506 | 2537 | #endif |
53dc5044 | 2538 | |
3115f94f | 2539 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2540 | template<typename _Tp> |
fa459900 PC |
2541 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2542 | double>::__type | |
53dc5044 | 2543 | log2(_Tp __x) |
b04fa738 | 2544 | { return __builtin_log2(__x); } |
3115f94f | 2545 | #endif |
53dc5044 | 2546 | |
3115f94f | 2547 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2548 | constexpr float |
53dc5044 PC |
2549 | logb(float __x) |
2550 | { return __builtin_logbf(__x); } | |
2551 | ||
fa459900 | 2552 | constexpr long double |
53dc5044 PC |
2553 | logb(long double __x) |
2554 | { return __builtin_logbl(__x); } | |
ef3a7506 | 2555 | #endif |
53dc5044 | 2556 | |
3115f94f | 2557 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2558 | template<typename _Tp> |
fa459900 PC |
2559 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2560 | double>::__type | |
53dc5044 | 2561 | logb(_Tp __x) |
b04fa738 | 2562 | { return __builtin_logb(__x); } |
3115f94f | 2563 | #endif |
53dc5044 | 2564 | |
3115f94f | 2565 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2566 | constexpr long |
53dc5044 PC |
2567 | lrint(float __x) |
2568 | { return __builtin_lrintf(__x); } | |
2569 | ||
fa459900 | 2570 | constexpr long |
53dc5044 PC |
2571 | lrint(long double __x) |
2572 | { return __builtin_lrintl(__x); } | |
ef3a7506 | 2573 | #endif |
53dc5044 | 2574 | |
3115f94f | 2575 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2576 | template<typename _Tp> |
fa459900 PC |
2577 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2578 | long>::__type | |
53dc5044 | 2579 | lrint(_Tp __x) |
b04fa738 | 2580 | { return __builtin_lrint(__x); } |
3115f94f | 2581 | #endif |
53dc5044 | 2582 | |
3115f94f | 2583 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2584 | constexpr long |
53dc5044 PC |
2585 | lround(float __x) |
2586 | { return __builtin_lroundf(__x); } | |
2587 | ||
fa459900 | 2588 | constexpr long |
53dc5044 PC |
2589 | lround(long double __x) |
2590 | { return __builtin_lroundl(__x); } | |
ef3a7506 | 2591 | #endif |
53dc5044 | 2592 | |
3115f94f | 2593 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2594 | template<typename _Tp> |
fa459900 PC |
2595 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2596 | long>::__type | |
53dc5044 | 2597 | lround(_Tp __x) |
b04fa738 | 2598 | { return __builtin_lround(__x); } |
3115f94f | 2599 | #endif |
53dc5044 | 2600 | |
3115f94f | 2601 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2602 | constexpr float |
53dc5044 PC |
2603 | nearbyint(float __x) |
2604 | { return __builtin_nearbyintf(__x); } | |
2605 | ||
fa459900 | 2606 | constexpr long double |
53dc5044 PC |
2607 | nearbyint(long double __x) |
2608 | { return __builtin_nearbyintl(__x); } | |
ef3a7506 | 2609 | #endif |
53dc5044 | 2610 | |
3115f94f | 2611 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2612 | template<typename _Tp> |
fa459900 PC |
2613 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2614 | double>::__type | |
53dc5044 | 2615 | nearbyint(_Tp __x) |
b04fa738 | 2616 | { return __builtin_nearbyint(__x); } |
3115f94f | 2617 | #endif |
53dc5044 | 2618 | |
3115f94f | 2619 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2620 | constexpr float |
53dc5044 PC |
2621 | nextafter(float __x, float __y) |
2622 | { return __builtin_nextafterf(__x, __y); } | |
2623 | ||
fa459900 | 2624 | constexpr long double |
53dc5044 PC |
2625 | nextafter(long double __x, long double __y) |
2626 | { return __builtin_nextafterl(__x, __y); } | |
ef3a7506 | 2627 | #endif |
53dc5044 | 2628 | |
3115f94f | 2629 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2630 | constexpr float |
53dc5044 PC |
2631 | nexttoward(float __x, long double __y) |
2632 | { return __builtin_nexttowardf(__x, __y); } | |
2633 | ||
fa459900 | 2634 | constexpr long double |
53dc5044 PC |
2635 | nexttoward(long double __x, long double __y) |
2636 | { return __builtin_nexttowardl(__x, __y); } | |
ef3a7506 | 2637 | #endif |
53dc5044 | 2638 | |
3115f94f | 2639 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2640 | template<typename _Tp> |
fa459900 PC |
2641 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2642 | double>::__type | |
53dc5044 | 2643 | nexttoward(_Tp __x, long double __y) |
b04fa738 | 2644 | { return __builtin_nexttoward(__x, __y); } |
3115f94f | 2645 | #endif |
53dc5044 | 2646 | |
3115f94f | 2647 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2648 | constexpr float |
53dc5044 PC |
2649 | remainder(float __x, float __y) |
2650 | { return __builtin_remainderf(__x, __y); } | |
2651 | ||
fa459900 | 2652 | constexpr long double |
53dc5044 PC |
2653 | remainder(long double __x, long double __y) |
2654 | { return __builtin_remainderl(__x, __y); } | |
ef3a7506 | 2655 | #endif |
53dc5044 | 2656 | |
3115f94f | 2657 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
77addcb7 | 2658 | inline float |
53dc5044 PC |
2659 | remquo(float __x, float __y, int* __pquo) |
2660 | { return __builtin_remquof(__x, __y, __pquo); } | |
2661 | ||
77addcb7 | 2662 | inline long double |
53dc5044 PC |
2663 | remquo(long double __x, long double __y, int* __pquo) |
2664 | { return __builtin_remquol(__x, __y, __pquo); } | |
ef3a7506 | 2665 | #endif |
53dc5044 | 2666 | |
3115f94f | 2667 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2668 | constexpr float |
53dc5044 PC |
2669 | rint(float __x) |
2670 | { return __builtin_rintf(__x); } | |
2671 | ||
fa459900 | 2672 | constexpr long double |
53dc5044 PC |
2673 | rint(long double __x) |
2674 | { return __builtin_rintl(__x); } | |
ef3a7506 | 2675 | #endif |
53dc5044 | 2676 | |
3115f94f | 2677 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2678 | template<typename _Tp> |
fa459900 PC |
2679 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2680 | double>::__type | |
53dc5044 | 2681 | rint(_Tp __x) |
b04fa738 | 2682 | { return __builtin_rint(__x); } |
3115f94f | 2683 | #endif |
53dc5044 | 2684 | |
3115f94f | 2685 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2686 | constexpr float |
53dc5044 PC |
2687 | round(float __x) |
2688 | { return __builtin_roundf(__x); } | |
2689 | ||
fa459900 | 2690 | constexpr long double |
53dc5044 PC |
2691 | round(long double __x) |
2692 | { return __builtin_roundl(__x); } | |
ef3a7506 | 2693 | #endif |
53dc5044 | 2694 | |
3115f94f | 2695 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2696 | template<typename _Tp> |
fa459900 PC |
2697 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2698 | double>::__type | |
53dc5044 | 2699 | round(_Tp __x) |
b04fa738 | 2700 | { return __builtin_round(__x); } |
3115f94f | 2701 | #endif |
53dc5044 | 2702 | |
3115f94f | 2703 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2704 | constexpr float |
53dc5044 PC |
2705 | scalbln(float __x, long __ex) |
2706 | { return __builtin_scalblnf(__x, __ex); } | |
2707 | ||
fa459900 | 2708 | constexpr long double |
53dc5044 PC |
2709 | scalbln(long double __x, long __ex) |
2710 | { return __builtin_scalblnl(__x, __ex); } | |
ef3a7506 | 2711 | #endif |
53dc5044 | 2712 | |
3115f94f | 2713 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2714 | template<typename _Tp> |
fa459900 PC |
2715 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2716 | double>::__type | |
53dc5044 | 2717 | scalbln(_Tp __x, long __ex) |
b04fa738 | 2718 | { return __builtin_scalbln(__x, __ex); } |
3115f94f | 2719 | #endif |
53dc5044 | 2720 | |
3115f94f | 2721 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2722 | constexpr float |
53dc5044 PC |
2723 | scalbn(float __x, int __ex) |
2724 | { return __builtin_scalbnf(__x, __ex); } | |
2725 | ||
fa459900 | 2726 | constexpr long double |
53dc5044 PC |
2727 | scalbn(long double __x, int __ex) |
2728 | { return __builtin_scalbnl(__x, __ex); } | |
ef3a7506 | 2729 | #endif |
53dc5044 | 2730 | |
3115f94f | 2731 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2732 | template<typename _Tp> |
fa459900 PC |
2733 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2734 | double>::__type | |
53dc5044 | 2735 | scalbn(_Tp __x, int __ex) |
b04fa738 | 2736 | { return __builtin_scalbn(__x, __ex); } |
3115f94f | 2737 | #endif |
53dc5044 | 2738 | |
3115f94f | 2739 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2740 | constexpr float |
53dc5044 PC |
2741 | tgamma(float __x) |
2742 | { return __builtin_tgammaf(__x); } | |
2743 | ||
fa459900 | 2744 | constexpr long double |
53dc5044 PC |
2745 | tgamma(long double __x) |
2746 | { return __builtin_tgammal(__x); } | |
ef3a7506 | 2747 | #endif |
53dc5044 | 2748 | |
3115f94f | 2749 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2750 | template<typename _Tp> |
fa459900 PC |
2751 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2752 | double>::__type | |
53dc5044 | 2753 | tgamma(_Tp __x) |
b04fa738 | 2754 | { return __builtin_tgamma(__x); } |
3115f94f | 2755 | #endif |
53dc5044 | 2756 | |
3115f94f | 2757 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
fa459900 | 2758 | constexpr float |
53dc5044 PC |
2759 | trunc(float __x) |
2760 | { return __builtin_truncf(__x); } | |
2761 | ||
fa459900 | 2762 | constexpr long double |
53dc5044 PC |
2763 | trunc(long double __x) |
2764 | { return __builtin_truncl(__x); } | |
ef3a7506 | 2765 | #endif |
53dc5044 | 2766 | |
3115f94f | 2767 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
53dc5044 | 2768 | template<typename _Tp> |
fa459900 PC |
2769 | constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, |
2770 | double>::__type | |
53dc5044 | 2771 | trunc(_Tp __x) |
b04fa738 | 2772 | { return __builtin_trunc(__x); } |
3115f94f | 2773 | #endif |
53dc5044 | 2774 | |
a23225fb JJ |
2775 | #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) |
2776 | constexpr _Float16 | |
2777 | acosh(_Float16 __x) | |
2778 | { return _Float16(__builtin_acoshf(__x)); } | |
53dc5044 | 2779 | |
a23225fb JJ |
2780 | constexpr _Float16 |
2781 | asinh(_Float16 __x) | |
2782 | { return _Float16(__builtin_asinhf(__x)); } | |
998e01a6 | 2783 | |
a23225fb JJ |
2784 | constexpr _Float16 |
2785 | atanh(_Float16 __x) | |
2786 | { return _Float16(__builtin_atanhf(__x)); } | |
998e01a6 | 2787 | |
a23225fb JJ |
2788 | constexpr _Float16 |
2789 | cbrt(_Float16 __x) | |
2790 | { return _Float16(__builtin_cbrtf(__x)); } | |
998e01a6 | 2791 | |
a23225fb JJ |
2792 | constexpr _Float16 |
2793 | copysign(_Float16 __x, _Float16 __y) | |
2794 | { return __builtin_copysignf16(__x, __y); } | |
998e01a6 | 2795 | |
a23225fb JJ |
2796 | constexpr _Float16 |
2797 | erf(_Float16 __x) | |
2798 | { return _Float16(__builtin_erff(__x)); } | |
2799 | ||
2800 | constexpr _Float16 | |
2801 | erfc(_Float16 __x) | |
2802 | { return _Float16(__builtin_erfcf(__x)); } | |
2803 | ||
2804 | constexpr _Float16 | |
2805 | exp2(_Float16 __x) | |
2806 | { return _Float16(__builtin_exp2f(__x)); } | |
2807 | ||
2808 | constexpr _Float16 | |
2809 | expm1(_Float16 __x) | |
2810 | { return _Float16(__builtin_expm1f(__x)); } | |
2811 | ||
2812 | constexpr _Float16 | |
2813 | fdim(_Float16 __x, _Float16 __y) | |
2814 | { return _Float16(__builtin_fdimf(__x, __y)); } | |
2815 | ||
2816 | constexpr _Float16 | |
2817 | fma(_Float16 __x, _Float16 __y, _Float16 __z) | |
2818 | { return _Float16(__builtin_fmaf(__x, __y, __z)); } | |
2819 | ||
2820 | constexpr _Float16 | |
2821 | fmax(_Float16 __x, _Float16 __y) | |
2822 | { return _Float16(__builtin_fmaxf(__x, __y)); } | |
2823 | ||
2824 | constexpr _Float16 | |
2825 | fmin(_Float16 __x, _Float16 __y) | |
2826 | { return _Float16(__builtin_fminf(__x, __y)); } | |
2827 | ||
2828 | constexpr _Float16 | |
2829 | hypot(_Float16 __x, _Float16 __y) | |
2830 | { return _Float16(__builtin_hypotf(__x, __y)); } | |
2831 | ||
2832 | constexpr int | |
2833 | ilogb(_Float16 __x) | |
2834 | { return _Float16(__builtin_ilogbf(__x)); } | |
2835 | ||
2836 | constexpr _Float16 | |
2837 | lgamma(_Float16 __x) | |
2838 | { return _Float16(__builtin_lgammaf(__x)); } | |
2839 | ||
2840 | constexpr long long | |
2841 | llrint(_Float16 __x) | |
2842 | { return _Float16(__builtin_llrintf(__x)); } | |
2843 | ||
2844 | constexpr long long | |
2845 | llround(_Float16 __x) | |
2846 | { return _Float16(__builtin_llroundf(__x)); } | |
2847 | ||
2848 | constexpr _Float16 | |
2849 | log1p(_Float16 __x) | |
2850 | { return _Float16(__builtin_log1pf(__x)); } | |
2851 | ||
2852 | // DR 568. | |
2853 | constexpr _Float16 | |
2854 | log2(_Float16 __x) | |
2855 | { return _Float16(__builtin_log2f(__x)); } | |
2856 | ||
2857 | constexpr _Float16 | |
2858 | logb(_Float16 __x) | |
2859 | { return _Float16(__builtin_logbf(__x)); } | |
2860 | ||
2861 | constexpr long | |
2862 | lrint(_Float16 __x) | |
2863 | { return _Float16(__builtin_lrintf(__x)); } | |
2864 | ||
2865 | constexpr long | |
2866 | lround(_Float16 __x) | |
2867 | { return _Float16(__builtin_lroundf(__x)); } | |
2868 | ||
2869 | constexpr _Float16 | |
2870 | nearbyint(_Float16 __x) | |
2871 | { return _Float16(__builtin_nearbyintf(__x)); } | |
2872 | ||
cbf56503 | 2873 | constexpr _Float16 |
ba281da2 JJ |
2874 | nextafter(_Float16 __x, _Float16 __y) |
2875 | { | |
cbf56503 JJ |
2876 | if (std::__is_constant_evaluated()) |
2877 | return __builtin_nextafterf16(__x, __y); | |
ba281da2 JJ |
2878 | #ifdef __INT16_TYPE__ |
2879 | using __float16_int_type = __INT16_TYPE__; | |
2880 | #else | |
2881 | using __float16_int_type = short int; | |
2882 | #endif | |
2883 | __float16_int_type __hx, __hy, __ix, __iy; | |
2884 | __builtin_memcpy(&__hx, &__x, sizeof(__x)); | |
2885 | __builtin_memcpy(&__hy, &__y, sizeof(__x)); | |
2886 | __ix = __hx & 0x7fff; // |x| | |
2887 | __iy = __hy & 0x7fff; // |y| | |
2888 | if (__ix > 0x7c00 || __iy > 0x7c00) // x or y is NaN | |
2889 | return __x + __y; | |
2890 | if (__x == __y) | |
2891 | return __y; // x == y, return y | |
2892 | if (__ix == 0) // x == 0 | |
2893 | { | |
2894 | __hy = (__hy & 0x8000) | 1; // return +-__FLT16_DENORM_MIN__ | |
2895 | __builtin_memcpy(&__x, &__hy, sizeof(__x)); | |
2896 | __builtin_nextafterf(0.0f, 1.0f); // raise underflow | |
2897 | return __x; | |
2898 | } | |
2899 | if (__hx >= 0) // x > 0 | |
2900 | { | |
2901 | if (__hx > __hy) // x > y, x -= ulp | |
2902 | --__hx; | |
2903 | else // x < y, x += ulp | |
2904 | ++__hx; | |
2905 | } | |
2906 | else // x < 0 | |
2907 | { | |
2908 | if (__hy >= 0 || __hx > __hy) // x < y, x -= ulp | |
2909 | --__hx; | |
2910 | else // x > y, x += ulp | |
2911 | ++__hx; | |
2912 | } | |
2913 | __hy = __hx & 0x7c00; | |
2914 | if (__hy >= 0x7c00) | |
2915 | __builtin_nextafterf(__FLT_MAX__, __builtin_inff()); // overflow | |
2916 | else if (__hy < 0x0400) | |
2917 | __builtin_nextafterf(__FLT_MIN__, 0.0f); // underflow | |
2918 | __builtin_memcpy(&__x, &__hx, sizeof(__x)); | |
2919 | return __x; | |
2920 | } | |
a23225fb JJ |
2921 | |
2922 | constexpr _Float16 | |
2923 | remainder(_Float16 __x, _Float16 __y) | |
2924 | { return _Float16(__builtin_remainderf(__x, __y)); } | |
2925 | ||
2926 | inline _Float16 | |
2927 | remquo(_Float16 __x, _Float16 __y, int* __pquo) | |
2928 | { return _Float16(__builtin_remquof(__x, __y, __pquo)); } | |
2929 | ||
2930 | constexpr _Float16 | |
2931 | rint(_Float16 __x) | |
2932 | { return _Float16(__builtin_rintf(__x)); } | |
2933 | ||
2934 | constexpr _Float16 | |
2935 | round(_Float16 __x) | |
2936 | { return _Float16(__builtin_roundf(__x)); } | |
2937 | ||
2938 | constexpr _Float16 | |
2939 | scalbln(_Float16 __x, long __ex) | |
2940 | { return _Float16(__builtin_scalblnf(__x, __ex)); } | |
2941 | ||
2942 | constexpr _Float16 | |
2943 | scalbn(_Float16 __x, int __ex) | |
2944 | { return _Float16(__builtin_scalbnf(__x, __ex)); } | |
2945 | ||
2946 | constexpr _Float16 | |
2947 | tgamma(_Float16 __x) | |
2948 | { return _Float16(__builtin_tgammaf(__x)); } | |
2949 | ||
2950 | constexpr _Float16 | |
2951 | trunc(_Float16 __x) | |
2952 | { return _Float16(__builtin_truncf(__x)); } | |
2953 | #endif | |
2954 | ||
2955 | #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
2956 | constexpr _Float32 | |
2957 | acosh(_Float32 __x) | |
2958 | { return __builtin_acoshf(__x); } | |
2959 | ||
2960 | constexpr _Float32 | |
2961 | asinh(_Float32 __x) | |
2962 | { return __builtin_asinhf(__x); } | |
2963 | ||
2964 | constexpr _Float32 | |
2965 | atanh(_Float32 __x) | |
2966 | { return __builtin_atanhf(__x); } | |
2967 | ||
2968 | constexpr _Float32 | |
2969 | cbrt(_Float32 __x) | |
2970 | { return __builtin_cbrtf(__x); } | |
2971 | ||
2972 | constexpr _Float32 | |
2973 | copysign(_Float32 __x, _Float32 __y) | |
2974 | { return __builtin_copysignf(__x, __y); } | |
2975 | ||
2976 | constexpr _Float32 | |
2977 | erf(_Float32 __x) | |
2978 | { return __builtin_erff(__x); } | |
2979 | ||
2980 | constexpr _Float32 | |
2981 | erfc(_Float32 __x) | |
2982 | { return __builtin_erfcf(__x); } | |
2983 | ||
2984 | constexpr _Float32 | |
2985 | exp2(_Float32 __x) | |
2986 | { return __builtin_exp2f(__x); } | |
2987 | ||
2988 | constexpr _Float32 | |
2989 | expm1(_Float32 __x) | |
2990 | { return __builtin_expm1f(__x); } | |
2991 | ||
2992 | constexpr _Float32 | |
2993 | fdim(_Float32 __x, _Float32 __y) | |
2994 | { return __builtin_fdimf(__x, __y); } | |
2995 | ||
2996 | constexpr _Float32 | |
2997 | fma(_Float32 __x, _Float32 __y, _Float32 __z) | |
2998 | { return __builtin_fmaf(__x, __y, __z); } | |
2999 | ||
3000 | constexpr _Float32 | |
3001 | fmax(_Float32 __x, _Float32 __y) | |
3002 | { return __builtin_fmaxf(__x, __y); } | |
3003 | ||
3004 | constexpr _Float32 | |
3005 | fmin(_Float32 __x, _Float32 __y) | |
3006 | { return __builtin_fminf(__x, __y); } | |
3007 | ||
3008 | constexpr _Float32 | |
3009 | hypot(_Float32 __x, _Float32 __y) | |
3010 | { return __builtin_hypotf(__x, __y); } | |
3011 | ||
3012 | constexpr int | |
3013 | ilogb(_Float32 __x) | |
3014 | { return __builtin_ilogbf(__x); } | |
3015 | ||
3016 | constexpr _Float32 | |
3017 | lgamma(_Float32 __x) | |
3018 | { return __builtin_lgammaf(__x); } | |
3019 | ||
3020 | constexpr long long | |
3021 | llrint(_Float32 __x) | |
3022 | { return __builtin_llrintf(__x); } | |
3023 | ||
3024 | constexpr long long | |
3025 | llround(_Float32 __x) | |
3026 | { return __builtin_llroundf(__x); } | |
3027 | ||
3028 | constexpr _Float32 | |
3029 | log1p(_Float32 __x) | |
3030 | { return __builtin_log1pf(__x); } | |
3031 | ||
3032 | // DR 568. | |
3033 | constexpr _Float32 | |
3034 | log2(_Float32 __x) | |
3035 | { return __builtin_log2f(__x); } | |
3036 | ||
3037 | constexpr _Float32 | |
3038 | logb(_Float32 __x) | |
3039 | { return __builtin_logbf(__x); } | |
3040 | ||
3041 | constexpr long | |
3042 | lrint(_Float32 __x) | |
3043 | { return __builtin_lrintf(__x); } | |
3044 | ||
3045 | constexpr long | |
3046 | lround(_Float32 __x) | |
3047 | { return __builtin_lroundf(__x); } | |
3048 | ||
3049 | constexpr _Float32 | |
3050 | nearbyint(_Float32 __x) | |
3051 | { return __builtin_nearbyintf(__x); } | |
3052 | ||
3053 | constexpr _Float32 | |
3054 | nextafter(_Float32 __x, _Float32 __y) | |
3055 | { return __builtin_nextafterf(__x, __y); } | |
3056 | ||
3057 | constexpr _Float32 | |
3058 | remainder(_Float32 __x, _Float32 __y) | |
3059 | { return __builtin_remainderf(__x, __y); } | |
3060 | ||
3061 | inline _Float32 | |
3062 | remquo(_Float32 __x, _Float32 __y, int* __pquo) | |
3063 | { return __builtin_remquof(__x, __y, __pquo); } | |
3064 | ||
3065 | constexpr _Float32 | |
3066 | rint(_Float32 __x) | |
3067 | { return __builtin_rintf(__x); } | |
3068 | ||
3069 | constexpr _Float32 | |
3070 | round(_Float32 __x) | |
3071 | { return __builtin_roundf(__x); } | |
3072 | ||
3073 | constexpr _Float32 | |
3074 | scalbln(_Float32 __x, long __ex) | |
3075 | { return __builtin_scalblnf(__x, __ex); } | |
3076 | ||
3077 | constexpr _Float32 | |
3078 | scalbn(_Float32 __x, int __ex) | |
3079 | { return __builtin_scalbnf(__x, __ex); } | |
3080 | ||
3081 | constexpr _Float32 | |
3082 | tgamma(_Float32 __x) | |
3083 | { return __builtin_tgammaf(__x); } | |
3084 | ||
3085 | constexpr _Float32 | |
3086 | trunc(_Float32 __x) | |
3087 | { return __builtin_truncf(__x); } | |
3088 | #endif | |
3089 | ||
3090 | #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) | |
3091 | constexpr _Float64 | |
3092 | acosh(_Float64 __x) | |
3093 | { return __builtin_acosh(__x); } | |
3094 | ||
3095 | constexpr _Float64 | |
3096 | asinh(_Float64 __x) | |
3097 | { return __builtin_asinh(__x); } | |
3098 | ||
3099 | constexpr _Float64 | |
3100 | atanh(_Float64 __x) | |
3101 | { return __builtin_atanh(__x); } | |
3102 | ||
3103 | constexpr _Float64 | |
3104 | cbrt(_Float64 __x) | |
3105 | { return __builtin_cbrt(__x); } | |
3106 | ||
3107 | constexpr _Float64 | |
3108 | copysign(_Float64 __x, _Float64 __y) | |
3109 | { return __builtin_copysign(__x, __y); } | |
3110 | ||
3111 | constexpr _Float64 | |
3112 | erf(_Float64 __x) | |
3113 | { return __builtin_erf(__x); } | |
3114 | ||
3115 | constexpr _Float64 | |
3116 | erfc(_Float64 __x) | |
3117 | { return __builtin_erfc(__x); } | |
3118 | ||
3119 | constexpr _Float64 | |
3120 | exp2(_Float64 __x) | |
3121 | { return __builtin_exp2(__x); } | |
3122 | ||
3123 | constexpr _Float64 | |
3124 | expm1(_Float64 __x) | |
3125 | { return __builtin_expm1(__x); } | |
3126 | ||
3127 | constexpr _Float64 | |
3128 | fdim(_Float64 __x, _Float64 __y) | |
3129 | { return __builtin_fdim(__x, __y); } | |
3130 | ||
3131 | constexpr _Float64 | |
3132 | fma(_Float64 __x, _Float64 __y, _Float64 __z) | |
3133 | { return __builtin_fma(__x, __y, __z); } | |
3134 | ||
3135 | constexpr _Float64 | |
3136 | fmax(_Float64 __x, _Float64 __y) | |
3137 | { return __builtin_fmax(__x, __y); } | |
3138 | ||
3139 | constexpr _Float64 | |
3140 | fmin(_Float64 __x, _Float64 __y) | |
3141 | { return __builtin_fmin(__x, __y); } | |
3142 | ||
3143 | constexpr _Float64 | |
3144 | hypot(_Float64 __x, _Float64 __y) | |
3145 | { return __builtin_hypot(__x, __y); } | |
3146 | ||
3147 | constexpr int | |
3148 | ilogb(_Float64 __x) | |
3149 | { return __builtin_ilogb(__x); } | |
3150 | ||
3151 | constexpr _Float64 | |
3152 | lgamma(_Float64 __x) | |
3153 | { return __builtin_lgamma(__x); } | |
3154 | ||
3155 | constexpr long long | |
3156 | llrint(_Float64 __x) | |
3157 | { return __builtin_llrint(__x); } | |
3158 | ||
3159 | constexpr long long | |
3160 | llround(_Float64 __x) | |
3161 | { return __builtin_llround(__x); } | |
3162 | ||
3163 | constexpr _Float64 | |
3164 | log1p(_Float64 __x) | |
3165 | { return __builtin_log1p(__x); } | |
3166 | ||
3167 | // DR 568. | |
3168 | constexpr _Float64 | |
3169 | log2(_Float64 __x) | |
3170 | { return __builtin_log2(__x); } | |
3171 | ||
3172 | constexpr _Float64 | |
3173 | logb(_Float64 __x) | |
3174 | { return __builtin_logb(__x); } | |
3175 | ||
3176 | constexpr long | |
3177 | lrint(_Float64 __x) | |
3178 | { return __builtin_lrint(__x); } | |
3179 | ||
3180 | constexpr long | |
3181 | lround(_Float64 __x) | |
3182 | { return __builtin_lround(__x); } | |
3183 | ||
3184 | constexpr _Float64 | |
3185 | nearbyint(_Float64 __x) | |
3186 | { return __builtin_nearbyint(__x); } | |
3187 | ||
3188 | constexpr _Float64 | |
3189 | nextafter(_Float64 __x, _Float64 __y) | |
3190 | { return __builtin_nextafter(__x, __y); } | |
3191 | ||
3192 | constexpr _Float64 | |
3193 | remainder(_Float64 __x, _Float64 __y) | |
3194 | { return __builtin_remainder(__x, __y); } | |
3195 | ||
3196 | inline _Float64 | |
3197 | remquo(_Float64 __x, _Float64 __y, int* __pquo) | |
3198 | { return __builtin_remquo(__x, __y, __pquo); } | |
3199 | ||
3200 | constexpr _Float64 | |
3201 | rint(_Float64 __x) | |
3202 | { return __builtin_rint(__x); } | |
3203 | ||
3204 | constexpr _Float64 | |
3205 | round(_Float64 __x) | |
3206 | { return __builtin_round(__x); } | |
3207 | ||
3208 | constexpr _Float64 | |
3209 | scalbln(_Float64 __x, long __ex) | |
3210 | { return __builtin_scalbln(__x, __ex); } | |
3211 | ||
3212 | constexpr _Float64 | |
3213 | scalbn(_Float64 __x, int __ex) | |
3214 | { return __builtin_scalbn(__x, __ex); } | |
3215 | ||
3216 | constexpr _Float64 | |
3217 | tgamma(_Float64 __x) | |
3218 | { return __builtin_tgamma(__x); } | |
3219 | ||
3220 | constexpr _Float64 | |
3221 | trunc(_Float64 __x) | |
3222 | { return __builtin_trunc(__x); } | |
3223 | #endif | |
3224 | ||
3225 | #if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) | |
3226 | constexpr _Float128 | |
3227 | acosh(_Float128 __x) | |
3228 | { return __builtin_acoshl(__x); } | |
3229 | ||
3230 | constexpr _Float128 | |
3231 | asinh(_Float128 __x) | |
3232 | { return __builtin_asinhl(__x); } | |
3233 | ||
3234 | constexpr _Float128 | |
3235 | atanh(_Float128 __x) | |
3236 | { return __builtin_atanhl(__x); } | |
3237 | ||
3238 | constexpr _Float128 | |
3239 | cbrt(_Float128 __x) | |
3240 | { return __builtin_cbrtl(__x); } | |
3241 | ||
3242 | constexpr _Float128 | |
3243 | copysign(_Float128 __x, _Float128 __y) | |
3244 | { return __builtin_copysignl(__x, __y); } | |
3245 | ||
3246 | constexpr _Float128 | |
3247 | erf(_Float128 __x) | |
3248 | { return __builtin_erfl(__x); } | |
3249 | ||
3250 | constexpr _Float128 | |
3251 | erfc(_Float128 __x) | |
3252 | { return __builtin_erfcl(__x); } | |
3253 | ||
3254 | constexpr _Float128 | |
3255 | exp2(_Float128 __x) | |
3256 | { return __builtin_exp2l(__x); } | |
3257 | ||
3258 | constexpr _Float128 | |
3259 | expm1(_Float128 __x) | |
3260 | { return __builtin_expm1l(__x); } | |
3261 | ||
3262 | constexpr _Float128 | |
3263 | fdim(_Float128 __x, _Float128 __y) | |
3264 | { return __builtin_fdiml(__x, __y); } | |
3265 | ||
3266 | constexpr _Float128 | |
3267 | fma(_Float128 __x, _Float128 __y, _Float128 __z) | |
3268 | { return __builtin_fmal(__x, __y, __z); } | |
3269 | ||
3270 | constexpr _Float128 | |
3271 | fmax(_Float128 __x, _Float128 __y) | |
3272 | { return __builtin_fmaxl(__x, __y); } | |
3273 | ||
3274 | constexpr _Float128 | |
3275 | fmin(_Float128 __x, _Float128 __y) | |
3276 | { return __builtin_fminl(__x, __y); } | |
3277 | ||
3278 | constexpr _Float128 | |
3279 | hypot(_Float128 __x, _Float128 __y) | |
3280 | { return __builtin_hypotl(__x, __y); } | |
3281 | ||
3282 | constexpr int | |
3283 | ilogb(_Float128 __x) | |
3284 | { return __builtin_ilogbl(__x); } | |
3285 | ||
3286 | constexpr _Float128 | |
3287 | lgamma(_Float128 __x) | |
3288 | { return __builtin_lgammal(__x); } | |
3289 | ||
3290 | constexpr long long | |
3291 | llrint(_Float128 __x) | |
3292 | { return __builtin_llrintl(__x); } | |
3293 | ||
3294 | constexpr long long | |
3295 | llround(_Float128 __x) | |
3296 | { return __builtin_llroundl(__x); } | |
3297 | ||
3298 | constexpr _Float128 | |
3299 | log1p(_Float128 __x) | |
3300 | { return __builtin_log1pl(__x); } | |
3301 | ||
3302 | // DR 568. | |
3303 | constexpr _Float128 | |
3304 | log2(_Float128 __x) | |
3305 | { return __builtin_log2l(__x); } | |
3306 | ||
3307 | constexpr _Float128 | |
3308 | logb(_Float128 __x) | |
3309 | { return __builtin_logbl(__x); } | |
3310 | ||
3311 | constexpr long | |
3312 | lrint(_Float128 __x) | |
3313 | { return __builtin_lrintl(__x); } | |
3314 | ||
3315 | constexpr long | |
3316 | lround(_Float128 __x) | |
3317 | { return __builtin_lroundl(__x); } | |
3318 | ||
3319 | constexpr _Float128 | |
3320 | nearbyint(_Float128 __x) | |
3321 | { return __builtin_nearbyintl(__x); } | |
3322 | ||
3323 | constexpr _Float128 | |
3324 | nextafter(_Float128 __x, _Float128 __y) | |
3325 | { return __builtin_nextafterl(__x, __y); } | |
3326 | ||
3327 | constexpr _Float128 | |
3328 | remainder(_Float128 __x, _Float128 __y) | |
3329 | { return __builtin_remainderl(__x, __y); } | |
3330 | ||
3331 | inline _Float128 | |
3332 | remquo(_Float128 __x, _Float128 __y, int* __pquo) | |
3333 | { return __builtin_remquol(__x, __y, __pquo); } | |
3334 | ||
3335 | constexpr _Float128 | |
3336 | rint(_Float128 __x) | |
3337 | { return __builtin_rintl(__x); } | |
3338 | ||
3339 | constexpr _Float128 | |
3340 | round(_Float128 __x) | |
3341 | { return __builtin_roundl(__x); } | |
3342 | ||
3343 | constexpr _Float128 | |
3344 | scalbln(_Float128 __x, long __ex) | |
3345 | { return __builtin_scalblnl(__x, __ex); } | |
3346 | ||
3347 | constexpr _Float128 | |
3348 | scalbn(_Float128 __x, int __ex) | |
3349 | { return __builtin_scalbnl(__x, __ex); } | |
3350 | ||
3351 | constexpr _Float128 | |
3352 | tgamma(_Float128 __x) | |
3353 | { return __builtin_tgammal(__x); } | |
3354 | ||
3355 | constexpr _Float128 | |
3356 | trunc(_Float128 __x) | |
3357 | { return __builtin_truncl(__x); } | |
3358 | #elif defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_HAVE_FLOAT128_MATH) | |
3359 | constexpr _Float128 | |
3360 | acosh(_Float128 __x) | |
3361 | { return __builtin_acoshf128(__x); } | |
3362 | ||
3363 | constexpr _Float128 | |
3364 | asinh(_Float128 __x) | |
3365 | { return __builtin_asinhf128(__x); } | |
3366 | ||
3367 | constexpr _Float128 | |
3368 | atanh(_Float128 __x) | |
3369 | { return __builtin_atanhf128(__x); } | |
3370 | ||
3371 | constexpr _Float128 | |
3372 | cbrt(_Float128 __x) | |
3373 | { return __builtin_cbrtf128(__x); } | |
3374 | ||
3375 | constexpr _Float128 | |
3376 | copysign(_Float128 __x, _Float128 __y) | |
3377 | { return __builtin_copysignf128(__x, __y); } | |
3378 | ||
3379 | constexpr _Float128 | |
3380 | erf(_Float128 __x) | |
3381 | { return __builtin_erff128(__x); } | |
3382 | ||
3383 | constexpr _Float128 | |
3384 | erfc(_Float128 __x) | |
3385 | { return __builtin_erfcf128(__x); } | |
3386 | ||
3387 | constexpr _Float128 | |
3388 | exp2(_Float128 __x) | |
3389 | { return __builtin_exp2f128(__x); } | |
3390 | ||
3391 | constexpr _Float128 | |
3392 | expm1(_Float128 __x) | |
3393 | { return __builtin_expm1f128(__x); } | |
3394 | ||
3395 | constexpr _Float128 | |
3396 | fdim(_Float128 __x, _Float128 __y) | |
3397 | { return __builtin_fdimf128(__x, __y); } | |
3398 | ||
3399 | constexpr _Float128 | |
3400 | fma(_Float128 __x, _Float128 __y, _Float128 __z) | |
3401 | { return __builtin_fmaf128(__x, __y, __z); } | |
3402 | ||
3403 | constexpr _Float128 | |
3404 | fmax(_Float128 __x, _Float128 __y) | |
3405 | { return __builtin_fmaxf128(__x, __y); } | |
3406 | ||
3407 | constexpr _Float128 | |
3408 | fmin(_Float128 __x, _Float128 __y) | |
3409 | { return __builtin_fminf128(__x, __y); } | |
3410 | ||
3411 | constexpr _Float128 | |
3412 | hypot(_Float128 __x, _Float128 __y) | |
3413 | { return __builtin_hypotf128(__x, __y); } | |
3414 | ||
3415 | constexpr int | |
3416 | ilogb(_Float128 __x) | |
3417 | { return __builtin_ilogbf128(__x); } | |
3418 | ||
3419 | constexpr _Float128 | |
3420 | lgamma(_Float128 __x) | |
3421 | { return __builtin_lgammaf128(__x); } | |
3422 | ||
3423 | constexpr long long | |
3424 | llrint(_Float128 __x) | |
3425 | { return __builtin_llrintf128(__x); } | |
3426 | ||
3427 | constexpr long long | |
3428 | llround(_Float128 __x) | |
3429 | { return __builtin_llroundf128(__x); } | |
3430 | ||
3431 | constexpr _Float128 | |
3432 | log1p(_Float128 __x) | |
3433 | { return __builtin_log1pf128(__x); } | |
3434 | ||
3435 | // DR 568. | |
3436 | constexpr _Float128 | |
3437 | log2(_Float128 __x) | |
3438 | { return __builtin_log2f128(__x); } | |
3439 | ||
3440 | constexpr _Float128 | |
3441 | logb(_Float128 __x) | |
3442 | { return __builtin_logbf128(__x); } | |
3443 | ||
3444 | constexpr long | |
3445 | lrint(_Float128 __x) | |
3446 | { return __builtin_lrintf128(__x); } | |
3447 | ||
3448 | constexpr long | |
3449 | lround(_Float128 __x) | |
3450 | { return __builtin_lroundf128(__x); } | |
3451 | ||
3452 | constexpr _Float128 | |
3453 | nearbyint(_Float128 __x) | |
3454 | { return __builtin_nearbyintf128(__x); } | |
3455 | ||
3456 | constexpr _Float128 | |
3457 | nextafter(_Float128 __x, _Float128 __y) | |
3458 | { return __builtin_nextafterf128(__x, __y); } | |
3459 | ||
3460 | constexpr _Float128 | |
3461 | remainder(_Float128 __x, _Float128 __y) | |
3462 | { return __builtin_remainderf128(__x, __y); } | |
3463 | ||
3464 | inline _Float128 | |
3465 | remquo(_Float128 __x, _Float128 __y, int* __pquo) | |
3466 | { return __builtin_remquof128(__x, __y, __pquo); } | |
3467 | ||
3468 | constexpr _Float128 | |
3469 | rint(_Float128 __x) | |
3470 | { return __builtin_rintf128(__x); } | |
3471 | ||
3472 | constexpr _Float128 | |
3473 | round(_Float128 __x) | |
3474 | { return __builtin_roundf128(__x); } | |
3475 | ||
3476 | constexpr _Float128 | |
3477 | scalbln(_Float128 __x, long __ex) | |
3478 | { return __builtin_scalblnf128(__x, __ex); } | |
3479 | ||
3480 | constexpr _Float128 | |
3481 | scalbn(_Float128 __x, int __ex) | |
3482 | { return __builtin_scalbnf128(__x, __ex); } | |
3483 | ||
3484 | constexpr _Float128 | |
3485 | tgamma(_Float128 __x) | |
3486 | { return __builtin_tgammaf128(__x); } | |
3487 | ||
3488 | constexpr _Float128 | |
3489 | trunc(_Float128 __x) | |
3490 | { return __builtin_truncf128(__x); } | |
3491 | #endif | |
3492 | ||
3493 | #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3494 | constexpr __gnu_cxx::__bfloat16_t | |
3495 | acosh(__gnu_cxx::__bfloat16_t __x) | |
3496 | { return __gnu_cxx::__bfloat16_t(__builtin_acoshf(__x)); } | |
3497 | ||
3498 | constexpr __gnu_cxx::__bfloat16_t | |
3499 | asinh(__gnu_cxx::__bfloat16_t __x) | |
3500 | { return __gnu_cxx::__bfloat16_t(__builtin_asinhf(__x)); } | |
3501 | ||
3502 | constexpr __gnu_cxx::__bfloat16_t | |
3503 | atanh(__gnu_cxx::__bfloat16_t __x) | |
3504 | { return __gnu_cxx::__bfloat16_t(__builtin_atanhf(__x)); } | |
3505 | ||
3506 | constexpr __gnu_cxx::__bfloat16_t | |
3507 | cbrt(__gnu_cxx::__bfloat16_t __x) | |
3508 | { return __gnu_cxx::__bfloat16_t(__builtin_cbrtf(__x)); } | |
3509 | ||
3510 | constexpr __gnu_cxx::__bfloat16_t | |
3511 | copysign(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
3512 | { return __gnu_cxx::__bfloat16_t(__builtin_copysignf(__x, __y)); } | |
3513 | ||
3514 | constexpr __gnu_cxx::__bfloat16_t | |
3515 | erf(__gnu_cxx::__bfloat16_t __x) | |
3516 | { return __gnu_cxx::__bfloat16_t(__builtin_erff(__x)); } | |
3517 | ||
3518 | constexpr __gnu_cxx::__bfloat16_t | |
3519 | erfc(__gnu_cxx::__bfloat16_t __x) | |
3520 | { return __gnu_cxx::__bfloat16_t(__builtin_erfcf(__x)); } | |
3521 | ||
3522 | constexpr __gnu_cxx::__bfloat16_t | |
3523 | exp2(__gnu_cxx::__bfloat16_t __x) | |
3524 | { return __gnu_cxx::__bfloat16_t(__builtin_exp2f(__x)); } | |
3525 | ||
3526 | constexpr __gnu_cxx::__bfloat16_t | |
3527 | expm1(__gnu_cxx::__bfloat16_t __x) | |
3528 | { return __gnu_cxx::__bfloat16_t(__builtin_expm1f(__x)); } | |
3529 | ||
3530 | constexpr __gnu_cxx::__bfloat16_t | |
3531 | fdim(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
3532 | { return __gnu_cxx::__bfloat16_t(__builtin_fdimf(__x, __y)); } | |
3533 | ||
3534 | constexpr __gnu_cxx::__bfloat16_t | |
3535 | fma(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z) | |
3536 | { return __gnu_cxx::__bfloat16_t(__builtin_fmaf(__x, __y, __z)); } | |
3537 | ||
3538 | constexpr __gnu_cxx::__bfloat16_t | |
3539 | fmax(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
3540 | { return __gnu_cxx::__bfloat16_t(__builtin_fmaxf(__x, __y)); } | |
3541 | ||
3542 | constexpr __gnu_cxx::__bfloat16_t | |
3543 | fmin(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
3544 | { return __gnu_cxx::__bfloat16_t(__builtin_fminf(__x, __y)); } | |
3545 | ||
3546 | constexpr __gnu_cxx::__bfloat16_t | |
3547 | hypot(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
3548 | { return __gnu_cxx::__bfloat16_t(__builtin_hypotf(__x, __y)); } | |
3549 | ||
3550 | constexpr int | |
3551 | ilogb(__gnu_cxx::__bfloat16_t __x) | |
3552 | { return __gnu_cxx::__bfloat16_t(__builtin_ilogbf(__x)); } | |
3553 | ||
3554 | constexpr __gnu_cxx::__bfloat16_t | |
3555 | lgamma(__gnu_cxx::__bfloat16_t __x) | |
3556 | { return __gnu_cxx::__bfloat16_t(__builtin_lgammaf(__x)); } | |
3557 | ||
3558 | constexpr long long | |
3559 | llrint(__gnu_cxx::__bfloat16_t __x) | |
3560 | { return __gnu_cxx::__bfloat16_t(__builtin_llrintf(__x)); } | |
3561 | ||
3562 | constexpr long long | |
3563 | llround(__gnu_cxx::__bfloat16_t __x) | |
3564 | { return __gnu_cxx::__bfloat16_t(__builtin_llroundf(__x)); } | |
3565 | ||
3566 | constexpr __gnu_cxx::__bfloat16_t | |
3567 | log1p(__gnu_cxx::__bfloat16_t __x) | |
3568 | { return __gnu_cxx::__bfloat16_t(__builtin_log1pf(__x)); } | |
3569 | ||
3570 | // DR 568. | |
3571 | constexpr __gnu_cxx::__bfloat16_t | |
3572 | log2(__gnu_cxx::__bfloat16_t __x) | |
3573 | { return __gnu_cxx::__bfloat16_t(__builtin_log2f(__x)); } | |
3574 | ||
3575 | constexpr __gnu_cxx::__bfloat16_t | |
3576 | logb(__gnu_cxx::__bfloat16_t __x) | |
3577 | { return __gnu_cxx::__bfloat16_t(__builtin_logbf(__x)); } | |
3578 | ||
3579 | constexpr long | |
3580 | lrint(__gnu_cxx::__bfloat16_t __x) | |
3581 | { return __gnu_cxx::__bfloat16_t(__builtin_lrintf(__x)); } | |
3582 | ||
3583 | constexpr long | |
3584 | lround(__gnu_cxx::__bfloat16_t __x) | |
3585 | { return __gnu_cxx::__bfloat16_t(__builtin_lroundf(__x)); } | |
3586 | ||
3587 | constexpr __gnu_cxx::__bfloat16_t | |
3588 | nearbyint(__gnu_cxx::__bfloat16_t __x) | |
3589 | { return __gnu_cxx::__bfloat16_t(__builtin_nearbyintf(__x)); } | |
3590 | ||
cbf56503 | 3591 | constexpr __gnu_cxx::__bfloat16_t |
ba281da2 JJ |
3592 | nextafter(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) |
3593 | { | |
cbf56503 JJ |
3594 | if (std::__is_constant_evaluated()) |
3595 | return __builtin_nextafterf16b(__x, __y); | |
ba281da2 JJ |
3596 | #ifdef __INT16_TYPE__ |
3597 | using __bfloat16_int_type = __INT16_TYPE__; | |
3598 | #else | |
3599 | using __bfloat16_int_type = short int; | |
3600 | #endif | |
3601 | __bfloat16_int_type __hx, __hy, __ix, __iy; | |
3602 | __builtin_memcpy(&__hx, &__x, sizeof(__x)); | |
3603 | __builtin_memcpy(&__hy, &__y, sizeof(__x)); | |
3604 | __ix = __hx & 0x7fff; // |x| | |
3605 | __iy = __hy & 0x7fff; // |y| | |
3606 | if (__ix > 0x7f80 || __iy > 0x7f80) // x or y is NaN | |
3607 | return __x + __y; | |
3608 | if (__x == __y) | |
3609 | return __y; // x == y, return y | |
3610 | if (__ix == 0) // x == 0 | |
3611 | { | |
3612 | __hy = (__hy & 0x8000) | 1; // return +-__BFLT16_DENORM_MIN__ | |
3613 | __builtin_memcpy(&__x, &__hy, sizeof(__x)); | |
3614 | __builtin_nextafterf(0.0f, 1.0f); // raise underflow | |
3615 | return __x; | |
3616 | } | |
3617 | if (__hx >= 0) // x > 0 | |
3618 | { | |
3619 | if (__hx > __hy) // x > y, x -= ulp | |
3620 | --__hx; | |
3621 | else // x < y, x += ulp | |
3622 | ++__hx; | |
3623 | } | |
3624 | else // x < 0 | |
3625 | { | |
3626 | if (__hy >= 0 || __hx > __hy) // x < y, x -= ulp | |
3627 | --__hx; | |
3628 | else // x > y, x += ulp | |
3629 | ++__hx; | |
3630 | } | |
3631 | __hy = __hx & 0x7f80; | |
3632 | if (__hy >= 0x7f80) | |
3633 | __builtin_nextafterf(__FLT_MAX__, __builtin_inff()); // overflow | |
3634 | else if (__hy < 0x0080) | |
3635 | __builtin_nextafterf(__FLT_MIN__, 0.0f); // underflow | |
3636 | __builtin_memcpy(&__x, &__hx, sizeof(__x)); | |
3637 | return __x; | |
3638 | } | |
a23225fb JJ |
3639 | |
3640 | constexpr __gnu_cxx::__bfloat16_t | |
3641 | remainder(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y) | |
3642 | { return __gnu_cxx::__bfloat16_t(__builtin_remainderf(__x, __y)); } | |
3643 | ||
3644 | inline __gnu_cxx::__bfloat16_t | |
3645 | remquo(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, int* __pquo) | |
3646 | { return __gnu_cxx::__bfloat16_t(__builtin_remquof(__x, __y, __pquo)); } | |
3647 | ||
3648 | constexpr __gnu_cxx::__bfloat16_t | |
3649 | rint(__gnu_cxx::__bfloat16_t __x) | |
3650 | { return __gnu_cxx::__bfloat16_t(__builtin_rintf(__x)); } | |
3651 | ||
3652 | constexpr __gnu_cxx::__bfloat16_t | |
3653 | round(__gnu_cxx::__bfloat16_t __x) | |
3654 | { return __gnu_cxx::__bfloat16_t(__builtin_roundf(__x)); } | |
3655 | ||
3656 | constexpr __gnu_cxx::__bfloat16_t | |
3657 | scalbln(__gnu_cxx::__bfloat16_t __x, long __ex) | |
3658 | { return __gnu_cxx::__bfloat16_t(__builtin_scalblnf(__x, __ex)); } | |
3659 | ||
3660 | constexpr __gnu_cxx::__bfloat16_t | |
3661 | scalbn(__gnu_cxx::__bfloat16_t __x, int __ex) | |
3662 | { return __gnu_cxx::__bfloat16_t(__builtin_scalbnf(__x, __ex)); } | |
3663 | ||
3664 | constexpr __gnu_cxx::__bfloat16_t | |
3665 | tgamma(__gnu_cxx::__bfloat16_t __x) | |
3666 | { return __gnu_cxx::__bfloat16_t(__builtin_tgammaf(__x)); } | |
3667 | ||
3668 | constexpr __gnu_cxx::__bfloat16_t | |
3669 | trunc(__gnu_cxx::__bfloat16_t __x) | |
3670 | { return __gnu_cxx::__bfloat16_t(__builtin_truncf(__x)); } | |
3671 | #endif | |
3672 | ||
883f1e25 JJ |
3673 | #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT |
3674 | template<typename _Tp, typename _Up> | |
3675 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3676 | copysign(_Tp __x, _Up __y) | |
3677 | { | |
3678 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3679 | return copysign(__type(__x), __type(__y)); | |
3680 | } | |
3681 | ||
3682 | template<typename _Tp, typename _Up> | |
3683 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3684 | fdim(_Tp __x, _Up __y) | |
3685 | { | |
3686 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3687 | return fdim(__type(__x), __type(__y)); | |
3688 | } | |
3689 | ||
3690 | template<typename _Tp, typename _Up> | |
3691 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3692 | fmax(_Tp __x, _Up __y) | |
3693 | { | |
3694 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3695 | return fmax(__type(__x), __type(__y)); | |
3696 | } | |
3697 | ||
3698 | template<typename _Tp, typename _Up> | |
3699 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3700 | fmin(_Tp __x, _Up __y) | |
3701 | { | |
3702 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3703 | return fmin(__type(__x), __type(__y)); | |
3704 | } | |
3705 | ||
3706 | template<typename _Tp, typename _Up> | |
3707 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3708 | hypot(_Tp __x, _Up __y) | |
3709 | { | |
3710 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3711 | return hypot(__type(__x), __type(__y)); | |
3712 | } | |
3713 | ||
3714 | template<typename _Tp, typename _Up> | |
3715 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3716 | nextafter(_Tp __x, _Up __y) | |
3717 | { | |
3718 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3719 | return nextafter(__type(__x), __type(__y)); | |
3720 | } | |
3721 | ||
3722 | template<typename _Tp, typename _Up> | |
3723 | constexpr typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3724 | remainder(_Tp __x, _Up __y) | |
3725 | { | |
3726 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3727 | return remainder(__type(__x), __type(__y)); | |
3728 | } | |
3729 | ||
3730 | template<typename _Tp, typename _Up> | |
3731 | inline typename __gnu_cxx::__promote_2<_Tp, _Up>::__type | |
3732 | remquo(_Tp __x, _Up __y, int* __pquo) | |
3733 | { | |
3734 | typedef typename __gnu_cxx::__promote_2<_Tp, _Up>::__type __type; | |
3735 | return remquo(__type(__x), __type(__y), __pquo); | |
3736 | } | |
3737 | ||
3738 | template<typename _Tp, typename _Up, typename _Vp> | |
3739 | constexpr typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type | |
3740 | fma(_Tp __x, _Up __y, _Vp __z) | |
3741 | { | |
3742 | typedef typename __gnu_cxx::__promote_3<_Tp, _Up, _Vp>::__type __type; | |
3743 | return fma(__type(__x), __type(__y), __type(__z)); | |
3744 | } | |
3745 | #endif | |
a23225fb | 3746 | |
1f378f6d | 3747 | #endif // _GLIBCXX_USE_C99_MATH_FUNCS |
a23225fb JJ |
3748 | #endif // C++11 |
3749 | ||
083b7f28 | 3750 | #ifdef __cpp_lib_hypot // C++ >= 17 && HOSTED |
a23225fb | 3751 | // [c.math.hypot3], three-dimensional hypotenuse |
a23225fb JJ |
3752 | template<typename _Tp> |
3753 | inline _Tp | |
3754 | __hypot3(_Tp __x, _Tp __y, _Tp __z) | |
3755 | { | |
3756 | __x = std::abs(__x); | |
3757 | __y = std::abs(__y); | |
3758 | __z = std::abs(__z); | |
3759 | if (_Tp __a = __x < __y ? __y < __z ? __z : __y : __x < __z ? __z : __x) | |
3760 | return __a * std::sqrt((__x / __a) * (__x / __a) | |
3761 | + (__y / __a) * (__y / __a) | |
3762 | + (__z / __a) * (__z / __a)); | |
3763 | else | |
3764 | return {}; | |
3765 | } | |
3766 | ||
3767 | inline float | |
3768 | hypot(float __x, float __y, float __z) | |
3769 | { return std::__hypot3<float>(__x, __y, __z); } | |
3770 | ||
3771 | inline double | |
3772 | hypot(double __x, double __y, double __z) | |
3773 | { return std::__hypot3<double>(__x, __y, __z); } | |
998e01a6 JW |
3774 | |
3775 | inline long double | |
3776 | hypot(long double __x, long double __y, long double __z) | |
3777 | { return std::__hypot3<long double>(__x, __y, __z); } | |
3778 | ||
3779 | template<typename _Tp, typename _Up, typename _Vp> | |
9017326e | 3780 | __gnu_cxx::__promoted_t<_Tp, _Up, _Vp> |
998e01a6 JW |
3781 | hypot(_Tp __x, _Up __y, _Vp __z) |
3782 | { | |
9017326e | 3783 | using __type = __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>; |
998e01a6 JW |
3784 | return std::__hypot3<__type>(__x, __y, __z); |
3785 | } | |
a23225fb JJ |
3786 | |
3787 | #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3788 | inline _Float16 | |
3789 | hypot(_Float16 __x, _Float16 __y, _Float16 __z) | |
3790 | { return std::__hypot3<_Float16>(__x, __y, __z); } | |
3791 | #endif | |
3792 | ||
3793 | #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3794 | inline _Float32 | |
3795 | hypot(_Float32 __x, _Float32 __y, _Float32 __z) | |
3796 | { return std::__hypot3<_Float32>(__x, __y, __z); } | |
3797 | #endif | |
3798 | ||
3799 | #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) | |
3800 | inline _Float64 | |
3801 | hypot(_Float64 __x, _Float64 __y, _Float64 __z) | |
3802 | { return std::__hypot3<_Float64>(__x, __y, __z); } | |
3803 | #endif | |
3804 | ||
3805 | #if defined(__STDCPP_FLOAT128_T__) \ | |
3806 | && (defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) \ | |
3807 | || defined(_GLIBCXX_HAVE_FLOAT128_MATH)) | |
3808 | inline _Float128 | |
3809 | hypot(_Float128 __x, _Float128 __y, _Float128 __z) | |
3810 | { return std::__hypot3<_Float128>(__x, __y, __z); } | |
3811 | #endif | |
3812 | ||
3813 | #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3814 | inline __gnu_cxx::__bfloat16_t | |
3815 | hypot(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z) | |
3816 | { return std::__hypot3<__gnu_cxx::__bfloat16_t>(__x, __y, __z); } | |
3817 | #endif | |
3818 | ||
083b7f28 | 3819 | #endif // __cpp_lib_hypot |
998e01a6 | 3820 | |
083b7f28 | 3821 | #ifdef __cpp_lib_interpolate // C++ >= 20 |
24387442 | 3822 | // linear interpolation |
24387442 JW |
3823 | template<typename _Fp> |
3824 | constexpr _Fp | |
360a758e | 3825 | __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept |
24387442 | 3826 | { |
ef8b4335 | 3827 | if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0)) |
24387442 JW |
3828 | return __t * __b + (1 - __t) * __a; |
3829 | ||
3830 | if (__t == 1) | |
3831 | return __b; // exact | |
3832 | ||
3833 | // Exact at __t=0, monotonic except near __t=1, | |
3834 | // bounded, determinate, and consistent: | |
3835 | const _Fp __x = __a + __t * (__b - __a); | |
ef8b4335 | 3836 | return (__t > 1) == (__b > __a) |
24387442 JW |
3837 | ? (__b < __x ? __x : __b) |
3838 | : (__b > __x ? __x : __b); // monotonic near __t=1 | |
3839 | } | |
3840 | ||
3841 | constexpr float | |
360a758e | 3842 | lerp(float __a, float __b, float __t) noexcept |
24387442 JW |
3843 | { return std::__lerp(__a, __b, __t); } |
3844 | ||
3845 | constexpr double | |
360a758e | 3846 | lerp(double __a, double __b, double __t) noexcept |
24387442 JW |
3847 | { return std::__lerp(__a, __b, __t); } |
3848 | ||
3849 | constexpr long double | |
360a758e | 3850 | lerp(long double __a, long double __b, long double __t) noexcept |
24387442 | 3851 | { return std::__lerp(__a, __b, __t); } |
9017326e JW |
3852 | |
3853 | template<typename _Tp, typename _Up, typename _Vp> | |
3854 | constexpr __gnu_cxx::__promoted_t<_Tp, _Up, _Vp> | |
3855 | lerp(_Tp __x, _Up __y, _Vp __z) noexcept | |
3856 | { | |
3857 | using __type = __gnu_cxx::__promoted_t<_Tp, _Up, _Vp>; | |
3858 | return std::__lerp<__type>(__x, __y, __z); | |
3859 | } | |
a23225fb JJ |
3860 | |
3861 | #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3862 | inline _Float16 | |
3863 | lerp(_Float16 __x, _Float16 __y, _Float16 __z) noexcept | |
3864 | { return std::__lerp<_Float16>(__x, __y, __z); } | |
3865 | #endif | |
3866 | ||
3867 | #if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3868 | inline _Float32 | |
3869 | lerp(_Float32 __x, _Float32 __y, _Float32 __z) noexcept | |
3870 | { return std::__lerp<_Float32>(__x, __y, __z); } | |
3871 | #endif | |
3872 | ||
3873 | #if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) | |
3874 | inline _Float64 | |
3875 | lerp(_Float64 __x, _Float64 __y, _Float64 __z) noexcept | |
3876 | { return std::__lerp<_Float64>(__x, __y, __z); } | |
3877 | #endif | |
3878 | ||
3879 | #if defined(__STDCPP_FLOAT128_T__) \ | |
3880 | && (defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) \ | |
3881 | || defined(_GLIBCXX_HAVE_FLOAT128_MATH)) | |
3882 | inline _Float128 | |
3883 | lerp(_Float128 __x, _Float128 __y, _Float128 __z) noexcept | |
3884 | { return std::__lerp<_Float128>(__x, __y, __z); } | |
3885 | #endif | |
3886 | ||
3887 | #if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) | |
3888 | inline __gnu_cxx::__bfloat16_t | |
3889 | lerp(__gnu_cxx::__bfloat16_t __x, __gnu_cxx::__bfloat16_t __y, __gnu_cxx::__bfloat16_t __z) noexcept | |
3890 | { return std::__lerp<__gnu_cxx::__bfloat16_t>(__x, __y, __z); } | |
3891 | #endif | |
083b7f28 | 3892 | #endif // __cpp_lib_interpolate |
24387442 | 3893 | |
4a15d842 FD |
3894 | _GLIBCXX_END_NAMESPACE_VERSION |
3895 | } // namespace | |
998e01a6 | 3896 | |
f8571e51 | 3897 | #if _GLIBCXX_USE_STD_SPEC_FUNCS |
2be75957 ESR |
3898 | # include <bits/specfun.h> |
3899 | #endif | |
3900 | ||
eac437bf JW |
3901 | } // extern "C++" |
3902 | ||
af13a7a6 | 3903 | #endif |