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