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