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