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 #ifndef _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
00043 #define _GLIBCXX_TR1_HYPERGEOMETRIC_TCC 1
00044
00045 namespace std
00046 {
00047 namespace tr1
00048 {
00049
00050
00051
00052
00053 namespace __detail
00054 {
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 template<typename _Tp>
00077 _Tp
00078 __conf_hyperg_series(const _Tp __a, const _Tp __c, const _Tp __x)
00079 {
00080 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
00081
00082 _Tp __term = _Tp(1);
00083 _Tp __Fac = _Tp(1);
00084 const unsigned int __max_iter = 100000;
00085 unsigned int __i;
00086 for (__i = 0; __i < __max_iter; ++__i)
00087 {
00088 __term *= (__a + _Tp(__i)) * __x
00089 / ((__c + _Tp(__i)) * _Tp(1 + __i));
00090 if (std::abs(__term) < __eps)
00091 {
00092 break;
00093 }
00094 __Fac += __term;
00095 }
00096 if (__i == __max_iter)
00097 std::__throw_runtime_error(__N("Series failed to converge "
00098 "in __conf_hyperg_series."));
00099
00100 return __Fac;
00101 }
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 template<typename _Tp>
00114 _Tp
00115 __conf_hyperg_luke(const _Tp __a, const _Tp __c, const _Tp __xin)
00116 {
00117 const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
00118 const int __nmax = 20000;
00119 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
00120 const _Tp __x = -__xin;
00121 const _Tp __x3 = __x * __x * __x;
00122 const _Tp __t0 = __a / __c;
00123 const _Tp __t1 = (__a + _Tp(1)) / (_Tp(2) * __c);
00124 const _Tp __t2 = (__a + _Tp(2)) / (_Tp(2) * (__c + _Tp(1)));
00125 _Tp __F = _Tp(1);
00126 _Tp __prec;
00127
00128 _Tp __Bnm3 = _Tp(1);
00129 _Tp __Bnm2 = _Tp(1) + __t1 * __x;
00130 _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
00131
00132 _Tp __Anm3 = _Tp(1);
00133 _Tp __Anm2 = __Bnm2 - __t0 * __x;
00134 _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
00135 + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
00136
00137 int __n = 3;
00138 while(1)
00139 {
00140 _Tp __npam1 = _Tp(__n - 1) + __a;
00141 _Tp __npcm1 = _Tp(__n - 1) + __c;
00142 _Tp __npam2 = _Tp(__n - 2) + __a;
00143 _Tp __npcm2 = _Tp(__n - 2) + __c;
00144 _Tp __tnm1 = _Tp(2 * __n - 1);
00145 _Tp __tnm3 = _Tp(2 * __n - 3);
00146 _Tp __tnm5 = _Tp(2 * __n - 5);
00147 _Tp __F1 = (_Tp(__n - 2) - __a) / (_Tp(2) * __tnm3 * __npcm1);
00148 _Tp __F2 = (_Tp(__n) + __a) * __npam1
00149 / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
00150 _Tp __F3 = -__npam2 * __npam1 * (_Tp(__n - 2) - __a)
00151 / (_Tp(8) * __tnm3 * __tnm3 * __tnm5
00152 * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
00153 _Tp __E = -__npam1 * (_Tp(__n - 1) - __c)
00154 / (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
00155
00156 _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
00157 + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
00158 _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
00159 + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
00160 _Tp __r = __An / __Bn;
00161
00162 __prec = std::abs((__F - __r) / __F);
00163 __F = __r;
00164
00165 if (__prec < __eps || __n > __nmax)
00166 break;
00167
00168 if (std::abs(__An) > __big || std::abs(__Bn) > __big)
00169 {
00170 __An /= __big;
00171 __Bn /= __big;
00172 __Anm1 /= __big;
00173 __Bnm1 /= __big;
00174 __Anm2 /= __big;
00175 __Bnm2 /= __big;
00176 __Anm3 /= __big;
00177 __Bnm3 /= __big;
00178 }
00179 else if (std::abs(__An) < _Tp(1) / __big
00180 || std::abs(__Bn) < _Tp(1) / __big)
00181 {
00182 __An *= __big;
00183 __Bn *= __big;
00184 __Anm1 *= __big;
00185 __Bnm1 *= __big;
00186 __Anm2 *= __big;
00187 __Bnm2 *= __big;
00188 __Anm3 *= __big;
00189 __Bnm3 *= __big;
00190 }
00191
00192 ++__n;
00193 __Bnm3 = __Bnm2;
00194 __Bnm2 = __Bnm1;
00195 __Bnm1 = __Bn;
00196 __Anm3 = __Anm2;
00197 __Anm2 = __Anm1;
00198 __Anm1 = __An;
00199 }
00200
00201 if (__n >= __nmax)
00202 std::__throw_runtime_error(__N("Iteration failed to converge "
00203 "in __conf_hyperg_luke."));
00204
00205 return __F;
00206 }
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 template<typename _Tp>
00221 inline _Tp
00222 __conf_hyperg(const _Tp __a, const _Tp __c, const _Tp __x)
00223 {
00224 #if _GLIBCXX_USE_C99_MATH_TR1
00225 const _Tp __c_nint = std::tr1::nearbyint(__c);
00226 #else
00227 const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
00228 #endif
00229 if (__isnan(__a) || __isnan(__c) || __isnan(__x))
00230 return std::numeric_limits<_Tp>::quiet_NaN();
00231 else if (__c_nint == __c && __c_nint <= 0)
00232 return std::numeric_limits<_Tp>::infinity();
00233 else if (__a == _Tp(0))
00234 return _Tp(1);
00235 else if (__c == __a)
00236 return std::exp(__x);
00237 else if (__x < _Tp(0))
00238 return __conf_hyperg_luke(__a, __c, __x);
00239 else
00240 return __conf_hyperg_series(__a, __c, __x);
00241 }
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264 template<typename _Tp>
00265 _Tp
00266 __hyperg_series(const _Tp __a, const _Tp __b,
00267 const _Tp __c, const _Tp __x)
00268 {
00269 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
00270
00271 _Tp __term = _Tp(1);
00272 _Tp __Fabc = _Tp(1);
00273 const unsigned int __max_iter = 100000;
00274 unsigned int __i;
00275 for (__i = 0; __i < __max_iter; ++__i)
00276 {
00277 __term *= (__a + _Tp(__i)) * (__b + _Tp(__i)) * __x
00278 / ((__c + _Tp(__i)) * _Tp(1 + __i));
00279 if (std::abs(__term) < __eps)
00280 {
00281 break;
00282 }
00283 __Fabc += __term;
00284 }
00285 if (__i == __max_iter)
00286 std::__throw_runtime_error(__N("Series failed to converge "
00287 "in __hyperg_series."));
00288
00289 return __Fabc;
00290 }
00291
00292
00293
00294
00295
00296
00297
00298 template<typename _Tp>
00299 _Tp
00300 __hyperg_luke(const _Tp __a, const _Tp __b, const _Tp __c,
00301 const _Tp __xin)
00302 {
00303 const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
00304 const int __nmax = 20000;
00305 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
00306 const _Tp __x = -__xin;
00307 const _Tp __x3 = __x * __x * __x;
00308 const _Tp __t0 = __a * __b / __c;
00309 const _Tp __t1 = (__a + _Tp(1)) * (__b + _Tp(1)) / (_Tp(2) * __c);
00310 const _Tp __t2 = (__a + _Tp(2)) * (__b + _Tp(2))
00311 / (_Tp(2) * (__c + _Tp(1)));
00312
00313 _Tp __F = _Tp(1);
00314
00315 _Tp __Bnm3 = _Tp(1);
00316 _Tp __Bnm2 = _Tp(1) + __t1 * __x;
00317 _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
00318
00319 _Tp __Anm3 = _Tp(1);
00320 _Tp __Anm2 = __Bnm2 - __t0 * __x;
00321 _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
00322 + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
00323
00324 int __n = 3;
00325 while (1)
00326 {
00327 const _Tp __npam1 = _Tp(__n - 1) + __a;
00328 const _Tp __npbm1 = _Tp(__n - 1) + __b;
00329 const _Tp __npcm1 = _Tp(__n - 1) + __c;
00330 const _Tp __npam2 = _Tp(__n - 2) + __a;
00331 const _Tp __npbm2 = _Tp(__n - 2) + __b;
00332 const _Tp __npcm2 = _Tp(__n - 2) + __c;
00333 const _Tp __tnm1 = _Tp(2 * __n - 1);
00334 const _Tp __tnm3 = _Tp(2 * __n - 3);
00335 const _Tp __tnm5 = _Tp(2 * __n - 5);
00336 const _Tp __n2 = __n * __n;
00337 const _Tp __F1 = (_Tp(3) * __n2 + (__a + __b - _Tp(6)) * __n
00338 + _Tp(2) - __a * __b - _Tp(2) * (__a + __b))
00339 / (_Tp(2) * __tnm3 * __npcm1);
00340 const _Tp __F2 = -(_Tp(3) * __n2 - (__a + __b + _Tp(6)) * __n
00341 + _Tp(2) - __a * __b) * __npam1 * __npbm1
00342 / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
00343 const _Tp __F3 = (__npam2 * __npam1 * __npbm2 * __npbm1
00344 * (_Tp(__n - 2) - __a) * (_Tp(__n - 2) - __b))
00345 / (_Tp(8) * __tnm3 * __tnm3 * __tnm5
00346 * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
00347 const _Tp __E = -__npam1 * __npbm1 * (_Tp(__n - 1) - __c)
00348 / (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
00349
00350 _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
00351 + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
00352 _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
00353 + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
00354 const _Tp __r = __An / __Bn;
00355
00356 const _Tp __prec = std::abs((__F - __r) / __F);
00357 __F = __r;
00358
00359 if (__prec < __eps || __n > __nmax)
00360 break;
00361
00362 if (std::abs(__An) > __big || std::abs(__Bn) > __big)
00363 {
00364 __An /= __big;
00365 __Bn /= __big;
00366 __Anm1 /= __big;
00367 __Bnm1 /= __big;
00368 __Anm2 /= __big;
00369 __Bnm2 /= __big;
00370 __Anm3 /= __big;
00371 __Bnm3 /= __big;
00372 }
00373 else if (std::abs(__An) < _Tp(1) / __big
00374 || std::abs(__Bn) < _Tp(1) / __big)
00375 {
00376 __An *= __big;
00377 __Bn *= __big;
00378 __Anm1 *= __big;
00379 __Bnm1 *= __big;
00380 __Anm2 *= __big;
00381 __Bnm2 *= __big;
00382 __Anm3 *= __big;
00383 __Bnm3 *= __big;
00384 }
00385
00386 ++__n;
00387 __Bnm3 = __Bnm2;
00388 __Bnm2 = __Bnm1;
00389 __Bnm1 = __Bn;
00390 __Anm3 = __Anm2;
00391 __Anm2 = __Anm1;
00392 __Anm1 = __An;
00393 }
00394
00395 if (__n >= __nmax)
00396 std::__throw_runtime_error(__N("Iteration failed to converge "
00397 "in __hyperg_luke."));
00398
00399 return __F;
00400 }
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432 template<typename _Tp>
00433 _Tp
00434 __hyperg_reflect(const _Tp __a, const _Tp __b, const _Tp __c,
00435 const _Tp __x)
00436 {
00437 const _Tp __d = __c - __a - __b;
00438 const int __intd = std::floor(__d + _Tp(0.5L));
00439 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
00440 const _Tp __toler = _Tp(1000) * __eps;
00441 const _Tp __log_max = std::log(std::numeric_limits<_Tp>::max());
00442 const bool __d_integer = (std::abs(__d - __intd) < __toler);
00443
00444 if (__d_integer)
00445 {
00446 const _Tp __ln_omx = std::log(_Tp(1) - __x);
00447 const _Tp __ad = std::abs(__d);
00448 _Tp __F1, __F2;
00449
00450 _Tp __d1, __d2;
00451 if (__d >= _Tp(0))
00452 {
00453 __d1 = __d;
00454 __d2 = _Tp(0);
00455 }
00456 else
00457 {
00458 __d1 = _Tp(0);
00459 __d2 = __d;
00460 }
00461
00462 const _Tp __lng_c = __log_gamma(__c);
00463
00464
00465 if (__ad < __eps)
00466 {
00467
00468 __F1 = _Tp(0);
00469 }
00470 else
00471 {
00472
00473 bool __ok_d1 = true;
00474 _Tp __lng_ad, __lng_ad1, __lng_bd1;
00475 __try
00476 {
00477 __lng_ad = __log_gamma(__ad);
00478 __lng_ad1 = __log_gamma(__a + __d1);
00479 __lng_bd1 = __log_gamma(__b + __d1);
00480 }
00481 __catch(...)
00482 {
00483 __ok_d1 = false;
00484 }
00485
00486 if (__ok_d1)
00487 {
00488
00489
00490
00491 _Tp __sum1 = _Tp(1);
00492 _Tp __term = _Tp(1);
00493 _Tp __ln_pre1 = __lng_ad + __lng_c + __d2 * __ln_omx
00494 - __lng_ad1 - __lng_bd1;
00495
00496
00497
00498 for (int __i = 1; __i < __ad; ++__i)
00499 {
00500 const int __j = __i - 1;
00501 __term *= (__a + __d2 + __j) * (__b + __d2 + __j)
00502 / (_Tp(1) + __d2 + __j) / __i * (_Tp(1) - __x);
00503 __sum1 += __term;
00504 }
00505
00506 if (__ln_pre1 > __log_max)
00507 std::__throw_runtime_error(__N("Overflow of gamma functions "
00508 "in __hyperg_luke."));
00509 else
00510 __F1 = std::exp(__ln_pre1) * __sum1;
00511 }
00512 else
00513 {
00514
00515
00516 __F1 = _Tp(0);
00517 }
00518 }
00519
00520
00521 bool __ok_d2 = true;
00522 _Tp __lng_ad2, __lng_bd2;
00523 __try
00524 {
00525 __lng_ad2 = __log_gamma(__a + __d2);
00526 __lng_bd2 = __log_gamma(__b + __d2);
00527 }
00528 __catch(...)
00529 {
00530 __ok_d2 = false;
00531 }
00532
00533 if (__ok_d2)
00534 {
00535
00536
00537 const int __maxiter = 2000;
00538 const _Tp __psi_1 = -__numeric_constants<_Tp>::__gamma_e();
00539 const _Tp __psi_1pd = __psi(_Tp(1) + __ad);
00540 const _Tp __psi_apd1 = __psi(__a + __d1);
00541 const _Tp __psi_bpd1 = __psi(__b + __d1);
00542
00543 _Tp __psi_term = __psi_1 + __psi_1pd - __psi_apd1
00544 - __psi_bpd1 - __ln_omx;
00545 _Tp __fact = _Tp(1);
00546 _Tp __sum2 = __psi_term;
00547 _Tp __ln_pre2 = __lng_c + __d1 * __ln_omx
00548 - __lng_ad2 - __lng_bd2;
00549
00550
00551 int __j;
00552 for (__j = 1; __j < __maxiter; ++__j)
00553 {
00554
00555 const _Tp __term1 = _Tp(1) / _Tp(__j)
00556 + _Tp(1) / (__ad + __j);
00557 const _Tp __term2 = _Tp(1) / (__a + __d1 + _Tp(__j - 1))
00558 + _Tp(1) / (__b + __d1 + _Tp(__j - 1));
00559 __psi_term += __term1 - __term2;
00560 __fact *= (__a + __d1 + _Tp(__j - 1))
00561 * (__b + __d1 + _Tp(__j - 1))
00562 / ((__ad + __j) * __j) * (_Tp(1) - __x);
00563 const _Tp __delta = __fact * __psi_term;
00564 __sum2 += __delta;
00565 if (std::abs(__delta) < __eps * std::abs(__sum2))
00566 break;
00567 }
00568 if (__j == __maxiter)
00569 std::__throw_runtime_error(__N("Sum F2 failed to converge "
00570 "in __hyperg_reflect"));
00571
00572 if (__sum2 == _Tp(0))
00573 __F2 = _Tp(0);
00574 else
00575 __F2 = std::exp(__ln_pre2) * __sum2;
00576 }
00577 else
00578 {
00579
00580
00581 __F2 = _Tp(0);
00582 }
00583
00584 const _Tp __sgn_2 = (__intd % 2 == 1 ? -_Tp(1) : _Tp(1));
00585 const _Tp __F = __F1 + __sgn_2 * __F2;
00586
00587 return __F;
00588 }
00589 else
00590 {
00591
00592
00593
00594
00595 bool __ok1 = true;
00596 _Tp __sgn_g1ca = _Tp(0), __ln_g1ca = _Tp(0);
00597 _Tp __sgn_g1cb = _Tp(0), __ln_g1cb = _Tp(0);
00598 __try
00599 {
00600 __sgn_g1ca = __log_gamma_sign(__c - __a);
00601 __ln_g1ca = __log_gamma(__c - __a);
00602 __sgn_g1cb = __log_gamma_sign(__c - __b);
00603 __ln_g1cb = __log_gamma(__c - __b);
00604 }
00605 __catch(...)
00606 {
00607 __ok1 = false;
00608 }
00609
00610 bool __ok2 = true;
00611 _Tp __sgn_g2a = _Tp(0), __ln_g2a = _Tp(0);
00612 _Tp __sgn_g2b = _Tp(0), __ln_g2b = _Tp(0);
00613 __try
00614 {
00615 __sgn_g2a = __log_gamma_sign(__a);
00616 __ln_g2a = __log_gamma(__a);
00617 __sgn_g2b = __log_gamma_sign(__b);
00618 __ln_g2b = __log_gamma(__b);
00619 }
00620 __catch(...)
00621 {
00622 __ok2 = false;
00623 }
00624
00625 const _Tp __sgn_gc = __log_gamma_sign(__c);
00626 const _Tp __ln_gc = __log_gamma(__c);
00627 const _Tp __sgn_gd = __log_gamma_sign(__d);
00628 const _Tp __ln_gd = __log_gamma(__d);
00629 const _Tp __sgn_gmd = __log_gamma_sign(-__d);
00630 const _Tp __ln_gmd = __log_gamma(-__d);
00631
00632 const _Tp __sgn1 = __sgn_gc * __sgn_gd * __sgn_g1ca * __sgn_g1cb;
00633 const _Tp __sgn2 = __sgn_gc * __sgn_gmd * __sgn_g2a * __sgn_g2b;
00634
00635 _Tp __pre1, __pre2;
00636 if (__ok1 && __ok2)
00637 {
00638 _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
00639 _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
00640 + __d * std::log(_Tp(1) - __x);
00641 if (__ln_pre1 < __log_max && __ln_pre2 < __log_max)
00642 {
00643 __pre1 = std::exp(__ln_pre1);
00644 __pre2 = std::exp(__ln_pre2);
00645 __pre1 *= __sgn1;
00646 __pre2 *= __sgn2;
00647 }
00648 else
00649 {
00650 std::__throw_runtime_error(__N("Overflow of gamma functions "
00651 "in __hyperg_reflect"));
00652 }
00653 }
00654 else if (__ok1 && !__ok2)
00655 {
00656 _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
00657 if (__ln_pre1 < __log_max)
00658 {
00659 __pre1 = std::exp(__ln_pre1);
00660 __pre1 *= __sgn1;
00661 __pre2 = _Tp(0);
00662 }
00663 else
00664 {
00665 std::__throw_runtime_error(__N("Overflow of gamma functions "
00666 "in __hyperg_reflect"));
00667 }
00668 }
00669 else if (!__ok1 && __ok2)
00670 {
00671 _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
00672 + __d * std::log(_Tp(1) - __x);
00673 if (__ln_pre2 < __log_max)
00674 {
00675 __pre1 = _Tp(0);
00676 __pre2 = std::exp(__ln_pre2);
00677 __pre2 *= __sgn2;
00678 }
00679 else
00680 {
00681 std::__throw_runtime_error(__N("Overflow of gamma functions "
00682 "in __hyperg_reflect"));
00683 }
00684 }
00685 else
00686 {
00687 __pre1 = _Tp(0);
00688 __pre2 = _Tp(0);
00689 std::__throw_runtime_error(__N("Underflow of gamma functions "
00690 "in __hyperg_reflect"));
00691 }
00692
00693 const _Tp __F1 = __hyperg_series(__a, __b, _Tp(1) - __d,
00694 _Tp(1) - __x);
00695 const _Tp __F2 = __hyperg_series(__c - __a, __c - __b, _Tp(1) + __d,
00696 _Tp(1) - __x);
00697
00698 const _Tp __F = __pre1 * __F1 + __pre2 * __F2;
00699
00700 return __F;
00701 }
00702 }
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 template<typename _Tp>
00723 inline _Tp
00724 __hyperg(const _Tp __a, const _Tp __b, const _Tp __c, const _Tp __x)
00725 {
00726 #if _GLIBCXX_USE_C99_MATH_TR1
00727 const _Tp __a_nint = std::tr1::nearbyint(__a);
00728 const _Tp __b_nint = std::tr1::nearbyint(__b);
00729 const _Tp __c_nint = std::tr1::nearbyint(__c);
00730 #else
00731 const _Tp __a_nint = static_cast<int>(__a + _Tp(0.5L));
00732 const _Tp __b_nint = static_cast<int>(__b + _Tp(0.5L));
00733 const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
00734 #endif
00735 const _Tp __toler = _Tp(1000) * std::numeric_limits<_Tp>::epsilon();
00736 if (std::abs(__x) >= _Tp(1))
00737 std::__throw_domain_error(__N("Argument outside unit circle "
00738 "in __hyperg."));
00739 else if (__isnan(__a) || __isnan(__b)
00740 || __isnan(__c) || __isnan(__x))
00741 return std::numeric_limits<_Tp>::quiet_NaN();
00742 else if (__c_nint == __c && __c_nint <= _Tp(0))
00743 return std::numeric_limits<_Tp>::infinity();
00744 else if (std::abs(__c - __b) < __toler || std::abs(__c - __a) < __toler)
00745 return std::pow(_Tp(1) - __x, __c - __a - __b);
00746 else if (__a >= _Tp(0) && __b >= _Tp(0) && __c >= _Tp(0)
00747 && __x >= _Tp(0) && __x < _Tp(0.995L))
00748 return __hyperg_series(__a, __b, __c, __x);
00749 else if (std::abs(__a) < _Tp(10) && std::abs(__b) < _Tp(10))
00750 {
00751
00752 if (__a < _Tp(0) && std::abs(__a - __a_nint) < __toler)
00753 return __hyperg_series(__a_nint, __b, __c, __x);
00754 else if (__b < _Tp(0) && std::abs(__b - __b_nint) < __toler)
00755 return __hyperg_series(__a, __b_nint, __c, __x);
00756 else if (__x < -_Tp(0.25L))
00757 return __hyperg_luke(__a, __b, __c, __x);
00758 else if (__x < _Tp(0.5L))
00759 return __hyperg_series(__a, __b, __c, __x);
00760 else
00761 if (std::abs(__c) > _Tp(10))
00762 return __hyperg_series(__a, __b, __c, __x);
00763 else
00764 return __hyperg_reflect(__a, __b, __c, __x);
00765 }
00766 else
00767 return __hyperg_luke(__a, __b, __c, __x);
00768 }
00769
00770 }
00771 }
00772 }
00773
00774 #endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC