00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef _GLIBCXX_CMATH
00046 #define _GLIBCXX_CMATH 1
00047
00048 #pragma GCC system_header
00049
00050 #include <bits/c++config.h>
00051 #include <bits/cpp_type_traits.h>
00052 #include <ext/type_traits.h>
00053
00054 #include <math.h>
00055
00056
00057 #undef abs
00058 #undef div
00059 #undef acos
00060 #undef asin
00061 #undef atan
00062 #undef atan2
00063 #undef ceil
00064 #undef cos
00065 #undef cosh
00066 #undef exp
00067 #undef fabs
00068 #undef floor
00069 #undef fmod
00070 #undef frexp
00071 #undef ldexp
00072 #undef log
00073 #undef log10
00074 #undef modf
00075 #undef pow
00076 #undef sin
00077 #undef sinh
00078 #undef sqrt
00079 #undef tan
00080 #undef tanh
00081
00082 _GLIBCXX_BEGIN_NAMESPACE(std)
00083
00084
00085
00086 template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);
00087
00088 inline double
00089 abs(double __x)
00090 { return __builtin_fabs(__x); }
00091
00092 inline float
00093 abs(float __x)
00094 { return __builtin_fabsf(__x); }
00095
00096 inline long double
00097 abs(long double __x)
00098 { return __builtin_fabsl(__x); }
00099
00100 using ::acos;
00101
00102 inline float
00103 acos(float __x)
00104 { return __builtin_acosf(__x); }
00105
00106 inline long double
00107 acos(long double __x)
00108 { return __builtin_acosl(__x); }
00109
00110 template<typename _Tp>
00111 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00112 double>::__type
00113 acos(_Tp __x)
00114 { return __builtin_acos(__x); }
00115
00116 using ::asin;
00117
00118 inline float
00119 asin(float __x)
00120 { return __builtin_asinf(__x); }
00121
00122 inline long double
00123 asin(long double __x)
00124 { return __builtin_asinl(__x); }
00125
00126 template<typename _Tp>
00127 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00128 double>::__type
00129 asin(_Tp __x)
00130 { return __builtin_asin(__x); }
00131
00132 using ::atan;
00133
00134 inline float
00135 atan(float __x)
00136 { return __builtin_atanf(__x); }
00137
00138 inline long double
00139 atan(long double __x)
00140 { return __builtin_atanl(__x); }
00141
00142 template<typename _Tp>
00143 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00144 double>::__type
00145 atan(_Tp __x)
00146 { return __builtin_atan(__x); }
00147
00148 using ::atan2;
00149
00150 inline float
00151 atan2(float __y, float __x)
00152 { return __builtin_atan2f(__y, __x); }
00153
00154 inline long double
00155 atan2(long double __y, long double __x)
00156 { return __builtin_atan2l(__y, __x); }
00157
00158 template<typename _Tp, typename _Up>
00159 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value
00160 && __is_integer<_Up>::__value,
00161 double>::__type
00162 atan2(_Tp __y, _Up __x)
00163 { return __builtin_atan2(__y, __x); }
00164
00165 using ::ceil;
00166
00167 inline float
00168 ceil(float __x)
00169 { return __builtin_ceilf(__x); }
00170
00171 inline long double
00172 ceil(long double __x)
00173 { return __builtin_ceill(__x); }
00174
00175 template<typename _Tp>
00176 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00177 double>::__type
00178 ceil(_Tp __x)
00179 { return __builtin_ceil(__x); }
00180
00181 using ::cos;
00182
00183 inline float
00184 cos(float __x)
00185 { return __builtin_cosf(__x); }
00186
00187 inline long double
00188 cos(long double __x)
00189 { return __builtin_cosl(__x); }
00190
00191 template<typename _Tp>
00192 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00193 double>::__type
00194 cos(_Tp __x)
00195 { return __builtin_cos(__x); }
00196
00197 using ::cosh;
00198
00199 inline float
00200 cosh(float __x)
00201 { return __builtin_coshf(__x); }
00202
00203 inline long double
00204 cosh(long double __x)
00205 { return __builtin_coshl(__x); }
00206
00207 template<typename _Tp>
00208 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00209 double>::__type
00210 cosh(_Tp __x)
00211 { return __builtin_cosh(__x); }
00212
00213 using ::exp;
00214
00215 inline float
00216 exp(float __x)
00217 { return __builtin_expf(__x); }
00218
00219 inline long double
00220 exp(long double __x)
00221 { return __builtin_expl(__x); }
00222
00223 template<typename _Tp>
00224 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00225 double>::__type
00226 exp(_Tp __x)
00227 { return __builtin_exp(__x); }
00228
00229 using ::fabs;
00230
00231 inline float
00232 fabs(float __x)
00233 { return __builtin_fabsf(__x); }
00234
00235 inline long double
00236 fabs(long double __x)
00237 { return __builtin_fabsl(__x); }
00238
00239 template<typename _Tp>
00240 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00241 double>::__type
00242 fabs(_Tp __x)
00243 { return __builtin_fabs(__x); }
00244
00245 using ::floor;
00246
00247 inline float
00248 floor(float __x)
00249 { return __builtin_floorf(__x); }
00250
00251 inline long double
00252 floor(long double __x)
00253 { return __builtin_floorl(__x); }
00254
00255 template<typename _Tp>
00256 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00257 double>::__type
00258 floor(_Tp __x)
00259 { return __builtin_floor(__x); }
00260
00261 using ::fmod;
00262
00263 inline float
00264 fmod(float __x, float __y)
00265 { return __builtin_fmodf(__x, __y); }
00266
00267 inline long double
00268 fmod(long double __x, long double __y)
00269 { return __builtin_fmodl(__x, __y); }
00270
00271 using ::frexp;
00272
00273 inline float
00274 frexp(float __x, int* __exp)
00275 { return __builtin_frexpf(__x, __exp); }
00276
00277 inline long double
00278 frexp(long double __x, int* __exp)
00279 { return __builtin_frexpl(__x, __exp); }
00280
00281 template<typename _Tp>
00282 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00283 double>::__type
00284 frexp(_Tp __x, int* __exp)
00285 { return __builtin_frexp(__x, __exp); }
00286
00287 using ::ldexp;
00288
00289 inline float
00290 ldexp(float __x, int __exp)
00291 { return __builtin_ldexpf(__x, __exp); }
00292
00293 inline long double
00294 ldexp(long double __x, int __exp)
00295 { return __builtin_ldexpl(__x, __exp); }
00296
00297 template<typename _Tp>
00298 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00299 double>::__type
00300 ldexp(_Tp __x, int __exp)
00301 { return __builtin_ldexp(__x, __exp); }
00302
00303 using ::log;
00304
00305 inline float
00306 log(float __x)
00307 { return __builtin_logf(__x); }
00308
00309 inline long double
00310 log(long double __x)
00311 { return __builtin_logl(__x); }
00312
00313 template<typename _Tp>
00314 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00315 double>::__type
00316 log(_Tp __x)
00317 { return __builtin_log(__x); }
00318
00319 using ::log10;
00320
00321 inline float
00322 log10(float __x)
00323 { return __builtin_log10f(__x); }
00324
00325 inline long double
00326 log10(long double __x)
00327 { return __builtin_log10l(__x); }
00328
00329 template<typename _Tp>
00330 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00331 double>::__type
00332 log10(_Tp __x)
00333 { return __builtin_log10(__x); }
00334
00335 using ::modf;
00336
00337 inline float
00338 modf(float __x, float* __iptr)
00339 { return __builtin_modff(__x, __iptr); }
00340
00341 inline long double
00342 modf(long double __x, long double* __iptr)
00343 { return __builtin_modfl(__x, __iptr); }
00344
00345 template<typename _Tp>
00346 inline _Tp
00347 __pow_helper(_Tp __x, int __n)
00348 {
00349 return __n < 0
00350 ? _Tp(1)/__cmath_power(__x, -__n)
00351 : __cmath_power(__x, __n);
00352 }
00353
00354 using ::pow;
00355
00356 inline float
00357 pow(float __x, float __y)
00358 { return __builtin_powf(__x, __y); }
00359
00360 inline long double
00361 pow(long double __x, long double __y)
00362 { return __builtin_powl(__x, __y); }
00363
00364 inline double
00365 pow(double __x, int __i)
00366 { return __builtin_powi(__x, __i); }
00367
00368 inline float
00369 pow(float __x, int __n)
00370 { return __builtin_powif(__x, __n); }
00371
00372 inline long double
00373 pow(long double __x, int __n)
00374 { return __builtin_powil(__x, __n); }
00375
00376 using ::sin;
00377
00378 inline float
00379 sin(float __x)
00380 { return __builtin_sinf(__x); }
00381
00382 inline long double
00383 sin(long double __x)
00384 { return __builtin_sinl(__x); }
00385
00386 template<typename _Tp>
00387 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00388 double>::__type
00389 sin(_Tp __x)
00390 { return __builtin_sin(__x); }
00391
00392 using ::sinh;
00393
00394 inline float
00395 sinh(float __x)
00396 { return __builtin_sinhf(__x); }
00397
00398 inline long double
00399 sinh(long double __x)
00400 { return __builtin_sinhl(__x); }
00401
00402 template<typename _Tp>
00403 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00404 double>::__type
00405 sinh(_Tp __x)
00406 { return __builtin_sinh(__x); }
00407
00408 using ::sqrt;
00409
00410 inline float
00411 sqrt(float __x)
00412 { return __builtin_sqrtf(__x); }
00413
00414 inline long double
00415 sqrt(long double __x)
00416 { return __builtin_sqrtl(__x); }
00417
00418 template<typename _Tp>
00419 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00420 double>::__type
00421 sqrt(_Tp __x)
00422 { return __builtin_sqrt(__x); }
00423
00424 using ::tan;
00425
00426 inline float
00427 tan(float __x)
00428 { return __builtin_tanf(__x); }
00429
00430 inline long double
00431 tan(long double __x)
00432 { return __builtin_tanl(__x); }
00433
00434 template<typename _Tp>
00435 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00436 double>::__type
00437 tan(_Tp __x)
00438 { return __builtin_tan(__x); }
00439
00440 using ::tanh;
00441
00442 inline float
00443 tanh(float __x)
00444 { return __builtin_tanhf(__x); }
00445
00446 inline long double
00447 tanh(long double __x)
00448 { return __builtin_tanhl(__x); }
00449
00450 template<typename _Tp>
00451 inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
00452 double>::__type
00453 tanh(_Tp __x)
00454 { return __builtin_tanh(__x); }
00455
00456 _GLIBCXX_END_NAMESPACE
00457
00458 #if _GLIBCXX_USE_C99_MATH
00459 #if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
00460
00461
00462
00463
00464 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
00465
00466 template<typename _Tp>
00467 inline int
00468 __capture_fpclassify(_Tp __f) { return fpclassify(__f); }
00469
00470 template<typename _Tp>
00471 inline int
00472 __capture_isfinite(_Tp __f) { return isfinite(__f); }
00473
00474 template<typename _Tp>
00475 inline int
00476 __capture_isinf(_Tp __f) { return isinf(__f); }
00477
00478 template<typename _Tp>
00479 inline int
00480 __capture_isnan(_Tp __f) { return isnan(__f); }
00481
00482 template<typename _Tp>
00483 inline int
00484 __capture_isnormal(_Tp __f) { return isnormal(__f); }
00485
00486 template<typename _Tp>
00487 inline int
00488 __capture_signbit(_Tp __f) { return signbit(__f); }
00489
00490 template<typename _Tp>
00491 inline int
00492 __capture_isgreater(_Tp __f1, _Tp __f2)
00493 { return isgreater(__f1, __f2); }
00494
00495 template<typename _Tp>
00496 inline int
00497 __capture_isgreaterequal(_Tp __f1, _Tp __f2)
00498 { return isgreaterequal(__f1, __f2); }
00499
00500 template<typename _Tp>
00501 inline int
00502 __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); }
00503
00504 template<typename _Tp>
00505 inline int
00506 __capture_islessequal(_Tp __f1, _Tp __f2)
00507 { return islessequal(__f1, __f2); }
00508
00509 template<typename _Tp>
00510 inline int
00511 __capture_islessgreater(_Tp __f1, _Tp __f2)
00512 { return islessgreater(__f1, __f2); }
00513
00514 template<typename _Tp>
00515 inline int
00516 __capture_isunordered(_Tp __f1, _Tp __f2)
00517 { return isunordered(__f1, __f2); }
00518
00519 _GLIBCXX_END_NAMESPACE
00520
00521
00522 #undef fpclassify
00523 #undef isfinite
00524 #undef isinf
00525 #undef isnan
00526 #undef isnormal
00527 #undef signbit
00528 #undef isgreater
00529 #undef isgreaterequal
00530 #undef isless
00531 #undef islessequal
00532 #undef islessgreater
00533 #undef isunordered
00534
00535 _GLIBCXX_BEGIN_NAMESPACE(std)
00536
00537 template<typename _Tp>
00538 inline int
00539 fpclassify(_Tp __f) { return ::__gnu_cxx::__capture_fpclassify(__f); }
00540
00541 template<typename _Tp>
00542 inline int
00543 isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); }
00544
00545 template<typename _Tp>
00546 inline int
00547 isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); }
00548
00549 template<typename _Tp>
00550 inline int
00551 isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
00552
00553 template<typename _Tp>
00554 inline int
00555 isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); }
00556
00557 template<typename _Tp>
00558 inline int
00559 signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); }
00560
00561 template<typename _Tp>
00562 inline int
00563 isgreater(_Tp __f1, _Tp __f2)
00564 { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); }
00565
00566 template<typename _Tp>
00567 inline int
00568 isgreaterequal(_Tp __f1, _Tp __f2)
00569 { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); }
00570
00571 template<typename _Tp>
00572 inline int
00573 isless(_Tp __f1, _Tp __f2)
00574 { return ::__gnu_cxx::__capture_isless(__f1, __f2); }
00575
00576 template<typename _Tp>
00577 inline int
00578 islessequal(_Tp __f1, _Tp __f2)
00579 { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); }
00580
00581 template<typename _Tp>
00582 inline int
00583 islessgreater(_Tp __f1, _Tp __f2)
00584 { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); }
00585
00586 template<typename _Tp>
00587 inline int
00588 isunordered(_Tp __f1, _Tp __f2)
00589 { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); }
00590
00591 _GLIBCXX_END_NAMESPACE
00592
00593 #endif
00594 #endif
00595
00596 #ifndef _GLIBCXX_EXPORT_TEMPLATE
00597 # include <bits/cmath.tcc>
00598 #endif
00599
00600 #endif