1 // Special functions -*- C++ -*-
3 // Copyright (C) 2006-2007
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
31 /** @file tr1/hypergeometric.tcc
32 * This is an internal header file, included by other library headers.
33 * You should not attempt to use it directly.
37 // ISO C++ 14882 TR1: 5.2 Special functions
40 // Written by Edward Smith-Rowland based:
41 // (1) Handbook of Mathematical Functions,
42 // ed. Milton Abramowitz and Irene A. Stegun,
43 // Dover Publications,
44 // Section 6, pp. 555-566
45 // (2) The Gnu Scientific Library, http://www.gnu.org/software/gsl
47 #ifndef _GLIBCXX_TR1_HYPERGEOMETRIC_TCC
48 #define _GLIBCXX_TR1_HYPERGEOMETRIC_TCC 1
55 // [5.2] Special functions
58 * @ingroup tr1_math_spec_func
63 // Implementation-space details.
69 * @brief This routine returns the confluent hypergeometric function
70 * by series expansion.
73 * _1F_1(a;c;x) = \frac{\Gamma(c)}{\Gamma(a)}
75 * \frac{\Gamma(a+n)}{\Gamma(c+n)}
79 * If a and b are integers and a < 0 and either b > 0 or b < a then the
80 * series is a polynomial with a finite number of terms. If b is an integer
81 * and b <= 0 the confluent hypergeometric function is undefined.
83 * @param __a The "numerator" parameter.
84 * @param __c The "denominator" parameter.
85 * @param __x The argument of the confluent hypergeometric function.
86 * @return The confluent hypergeometric function.
88 template<typename _Tp>
90 __conf_hyperg_series(const _Tp __a, const _Tp __c, const _Tp __x)
92 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
96 const unsigned int __max_iter = 100000;
98 for (__i = 0; __i < __max_iter; ++__i)
100 __term *= (__a + _Tp(__i)) * __x
101 / ((__c + _Tp(__i)) * _Tp(1 + __i));
102 if (std::abs(__term) < __eps)
108 if (__i == __max_iter)
109 std::__throw_runtime_error(__N("Series failed to converge "
110 "in __conf_hyperg_series."));
117 * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
118 * by an iterative procedure described in
119 * Luke, Algorithms for the Computation of Mathematical Functions.
121 * Like the case of the 2F1 rational approximations, these are
122 * probably guaranteed to converge for x < 0, barring gross
123 * numerical instability in the pre-asymptotic regime.
125 template<typename _Tp>
127 __conf_hyperg_luke(const _Tp __a, const _Tp __c, const _Tp __xin)
129 const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
130 const int __nmax = 20000;
131 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
132 const _Tp __x = -__xin;
133 const _Tp __x3 = __x * __x * __x;
134 const _Tp __t0 = __a / __c;
135 const _Tp __t1 = (__a + _Tp(1)) / (_Tp(2) * __c);
136 const _Tp __t2 = (__a + _Tp(2)) / (_Tp(2) * (__c + _Tp(1)));
141 _Tp __Bnm2 = _Tp(1) + __t1 * __x;
142 _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
145 _Tp __Anm2 = __Bnm2 - __t0 * __x;
146 _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
147 + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
152 _Tp __npam1 = _Tp(__n - 1) + __a;
153 _Tp __npcm1 = _Tp(__n - 1) + __c;
154 _Tp __npam2 = _Tp(__n - 2) + __a;
155 _Tp __npcm2 = _Tp(__n - 2) + __c;
156 _Tp __tnm1 = _Tp(2 * __n - 1);
157 _Tp __tnm3 = _Tp(2 * __n - 3);
158 _Tp __tnm5 = _Tp(2 * __n - 5);
159 _Tp __F1 = (_Tp(__n - 2) - __a) / (_Tp(2) * __tnm3 * __npcm1);
160 _Tp __F2 = (_Tp(__n) + __a) * __npam1
161 / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
162 _Tp __F3 = -__npam2 * __npam1 * (_Tp(__n - 2) - __a)
163 / (_Tp(8) * __tnm3 * __tnm3 * __tnm5
164 * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
165 _Tp __E = -__npam1 * (_Tp(__n - 1) - __c)
166 / (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
168 _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
169 + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
170 _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
171 + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
172 _Tp __r = __An / __Bn;
174 __prec = std::abs((__F - __r) / __F);
177 if (__prec < __eps || __n > __nmax)
180 if (std::abs(__An) > __big || std::abs(__Bn) > __big)
191 else if (std::abs(__An) < _Tp(1) / __big
192 || std::abs(__Bn) < _Tp(1) / __big)
214 std::__throw_runtime_error(__N("Iteration failed to converge "
215 "in __conf_hyperg_luke."));
222 * @brief Return the confluent hypogeometric function
223 * @f$ _1F_1(a;c;x) @f$.
225 * @todo Handle b == nonpositive integer blowup - return NaN.
227 * @param __a The "numerator" parameter.
228 * @param __c The "denominator" parameter.
229 * @param __x The argument of the confluent hypergeometric function.
230 * @return The confluent hypergeometric function.
232 template<typename _Tp>
234 __conf_hyperg(const _Tp __a, const _Tp __c, const _Tp __x)
236 #if _GLIBCXX_USE_C99_MATH_TR1
237 const _Tp __c_nint = std::tr1::nearbyint(__c);
239 const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
241 if (__isnan(__a) || __isnan(__c) || __isnan(__x))
242 return std::numeric_limits<_Tp>::quiet_NaN();
243 else if (__c_nint == __c && __c_nint <= 0)
244 return std::numeric_limits<_Tp>::infinity();
245 else if (__a == _Tp(0))
248 return std::exp(__x);
249 else if (__x < _Tp(0))
250 return __conf_hyperg_luke(__a, __c, __x);
252 return __conf_hyperg_series(__a, __c, __x);
257 * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
258 * by series expansion.
260 * The hypogeometric function is defined by
262 * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
263 * \sum_{n=0}^{\infty}
264 * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
268 * This works and it's pretty fast.
270 * @param __a The first "numerator" parameter.
271 * @param __a The second "numerator" parameter.
272 * @param __c The "denominator" parameter.
273 * @param __x The argument of the confluent hypergeometric function.
274 * @return The confluent hypergeometric function.
276 template<typename _Tp>
278 __hyperg_series(const _Tp __a, const _Tp __b,
279 const _Tp __c, const _Tp __x)
281 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
285 const unsigned int __max_iter = 100000;
287 for (__i = 0; __i < __max_iter; ++__i)
289 __term *= (__a + _Tp(__i)) * (__b + _Tp(__i)) * __x
290 / ((__c + _Tp(__i)) * _Tp(1 + __i));
291 if (std::abs(__term) < __eps)
297 if (__i == __max_iter)
298 std::__throw_runtime_error(__N("Series failed to converge "
299 "in __hyperg_series."));
306 * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$
307 * by an iterative procedure described in
308 * Luke, Algorithms for the Computation of Mathematical Functions.
310 template<typename _Tp>
312 __hyperg_luke(const _Tp __a, const _Tp __b, const _Tp __c,
315 const _Tp __big = std::pow(std::numeric_limits<_Tp>::max(), _Tp(0.16L));
316 const int __nmax = 20000;
317 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
318 const _Tp __x = -__xin;
319 const _Tp __x3 = __x * __x * __x;
320 const _Tp __t0 = __a * __b / __c;
321 const _Tp __t1 = (__a + _Tp(1)) * (__b + _Tp(1)) / (_Tp(2) * __c);
322 const _Tp __t2 = (__a + _Tp(2)) * (__b + _Tp(2))
323 / (_Tp(2) * (__c + _Tp(1)));
328 _Tp __Bnm2 = _Tp(1) + __t1 * __x;
329 _Tp __Bnm1 = _Tp(1) + __t2 * __x * (_Tp(1) + __t1 / _Tp(3) * __x);
332 _Tp __Anm2 = __Bnm2 - __t0 * __x;
333 _Tp __Anm1 = __Bnm1 - __t0 * (_Tp(1) + __t2 * __x) * __x
334 + __t0 * __t1 * (__c / (__c + _Tp(1))) * __x * __x;
339 const _Tp __npam1 = _Tp(__n - 1) + __a;
340 const _Tp __npbm1 = _Tp(__n - 1) + __b;
341 const _Tp __npcm1 = _Tp(__n - 1) + __c;
342 const _Tp __npam2 = _Tp(__n - 2) + __a;
343 const _Tp __npbm2 = _Tp(__n - 2) + __b;
344 const _Tp __npcm2 = _Tp(__n - 2) + __c;
345 const _Tp __tnm1 = _Tp(2 * __n - 1);
346 const _Tp __tnm3 = _Tp(2 * __n - 3);
347 const _Tp __tnm5 = _Tp(2 * __n - 5);
348 const _Tp __n2 = __n * __n;
349 const _Tp __F1 = (_Tp(3) * __n2 + (__a + __b - _Tp(6)) * __n
350 + _Tp(2) - __a * __b - _Tp(2) * (__a + __b))
351 / (_Tp(2) * __tnm3 * __npcm1);
352 const _Tp __F2 = -(_Tp(3) * __n2 - (__a + __b + _Tp(6)) * __n
353 + _Tp(2) - __a * __b) * __npam1 * __npbm1
354 / (_Tp(4) * __tnm1 * __tnm3 * __npcm2 * __npcm1);
355 const _Tp __F3 = (__npam2 * __npam1 * __npbm2 * __npbm1
356 * (_Tp(__n - 2) - __a) * (_Tp(__n - 2) - __b))
357 / (_Tp(8) * __tnm3 * __tnm3 * __tnm5
358 * (_Tp(__n - 3) + __c) * __npcm2 * __npcm1);
359 const _Tp __E = -__npam1 * __npbm1 * (_Tp(__n - 1) - __c)
360 / (_Tp(2) * __tnm3 * __npcm2 * __npcm1);
362 _Tp __An = (_Tp(1) + __F1 * __x) * __Anm1
363 + (__E + __F2 * __x) * __x * __Anm2 + __F3 * __x3 * __Anm3;
364 _Tp __Bn = (_Tp(1) + __F1 * __x) * __Bnm1
365 + (__E + __F2 * __x) * __x * __Bnm2 + __F3 * __x3 * __Bnm3;
366 const _Tp __r = __An / __Bn;
368 const _Tp __prec = std::abs((__F - __r) / __F);
371 if (__prec < __eps || __n > __nmax)
374 if (std::abs(__An) > __big || std::abs(__Bn) > __big)
385 else if (std::abs(__An) < _Tp(1) / __big
386 || std::abs(__Bn) < _Tp(1) / __big)
408 std::__throw_runtime_error(__N("Iteration failed to converge "
409 "in __hyperg_luke."));
416 * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$ by the reflection
417 * formulae in Abramowitz & Stegun formula 15.3.6 for d = c - a - b not integral
418 * and formula 15.3.11 for d = c - a - b integral.
419 * This assumes a, b, c != negative integer.
421 * The hypogeometric function is defined by
423 * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
424 * \sum_{n=0}^{\infty}
425 * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
429 * The reflection formula for nonintegral @f$ d = c - a - b @f$ is:
431 * _2F_1(a,b;c;x) = \frac{\Gamma(c)\Gamma(d)}{\Gamma(c-a)\Gamma(c-b)}
433 * + \frac{\Gamma(c)\Gamma(-d)}{\Gamma(a)\Gamma(b)}
434 * _2F_1(c-a,c-b;1+d;1-x)
437 * The reflection formula for integral @f$ m = c - a - b @f$ is:
439 * _2F_1(a,b;a+b+m;x) = \frac{\Gamma(m)\Gamma(a+b+m)}{\Gamma(a+m)\Gamma(b+m)}
440 * \sum_{k=0}^{m-1} \frac{(m+a)_k(m+b)_k}{k!(1-m)_k}
444 template<typename _Tp>
446 __hyperg_reflect(const _Tp __a, const _Tp __b, const _Tp __c,
449 const _Tp __d = __c - __a - __b;
450 const int __intd = std::floor(__d + _Tp(0.5L));
451 const _Tp __eps = std::numeric_limits<_Tp>::epsilon();
452 const _Tp __toler = _Tp(1000) * __eps;
453 const _Tp __log_max = std::log(std::numeric_limits<_Tp>::max());
454 const bool __d_integer = (std::abs(__d - __intd) < __toler);
458 const _Tp __ln_omx = std::log(_Tp(1) - __x);
459 const _Tp __ad = std::abs(__d);
474 const _Tp __lng_c = __log_gamma(__c);
479 // d = c - a - b = 0.
486 _Tp __lng_ad, __lng_ad1, __lng_bd1;
489 __lng_ad = __log_gamma(__ad);
490 __lng_ad1 = __log_gamma(__a + __d1);
491 __lng_bd1 = __log_gamma(__b + __d1);
500 /* Gamma functions in the denominator are ok.
501 * Proceed with evaluation.
505 _Tp __ln_pre1 = __lng_ad + __lng_c + __d2 * __ln_omx
506 - __lng_ad1 - __lng_bd1;
510 for (int __i = 1; __i < __ad; ++__i)
512 const int __j = __i - 1;
513 __term *= (__a + __d2 + __j) * (__b + __d2 + __j)
514 / (_Tp(1) + __d2 + __j) / __i * (_Tp(1) - __x);
518 if (__ln_pre1 > __log_max)
519 std::__throw_runtime_error(__N("Overflow of gamma functions "
520 "in __hyperg_luke."));
522 __F1 = std::exp(__ln_pre1) * __sum1;
526 // Gamma functions in the denominator were not ok.
527 // So the F1 term is zero.
530 } // end F1 evaluation
534 _Tp __lng_ad2, __lng_bd2;
537 __lng_ad2 = __log_gamma(__a + __d2);
538 __lng_bd2 = __log_gamma(__b + __d2);
547 // Gamma functions in the denominator are ok.
548 // Proceed with evaluation.
549 const int __maxiter = 2000;
550 const _Tp __psi_1 = -__numeric_constants<_Tp>::__gamma_e();
551 const _Tp __psi_1pd = __psi(_Tp(1) + __ad);
552 const _Tp __psi_apd1 = __psi(__a + __d1);
553 const _Tp __psi_bpd1 = __psi(__b + __d1);
555 _Tp __psi_term = __psi_1 + __psi_1pd - __psi_apd1
556 - __psi_bpd1 - __ln_omx;
558 _Tp __sum2 = __psi_term;
559 _Tp __ln_pre2 = __lng_c + __d1 * __ln_omx
560 - __lng_ad2 - __lng_bd2;
564 for (__j = 1; __j < __maxiter; ++__j)
566 // Values for psi functions use recurrence; Abramowitz & Stegun 6.3.5
567 const _Tp __term1 = _Tp(1) / _Tp(__j)
568 + _Tp(1) / (__ad + __j);
569 const _Tp __term2 = _Tp(1) / (__a + __d1 + _Tp(__j - 1))
570 + _Tp(1) / (__b + __d1 + _Tp(__j - 1));
571 __psi_term += __term1 - __term2;
572 __fact *= (__a + __d1 + _Tp(__j - 1))
573 * (__b + __d1 + _Tp(__j - 1))
574 / ((__ad + __j) * __j) * (_Tp(1) - __x);
575 const _Tp __delta = __fact * __psi_term;
577 if (std::abs(__delta) < __eps * std::abs(__sum2))
580 if (__j == __maxiter)
581 std::__throw_runtime_error(__N("Sum F2 failed to converge "
582 "in __hyperg_reflect"));
584 if (__sum2 == _Tp(0))
587 __F2 = std::exp(__ln_pre2) * __sum2;
591 // Gamma functions in the denominator not ok.
592 // So the F2 term is zero.
594 } // end F2 evaluation
596 const _Tp __sgn_2 = (__intd % 2 == 1 ? -_Tp(1) : _Tp(1));
597 const _Tp __F = __F1 + __sgn_2 * __F2;
603 // d = c - a - b not an integer.
605 // These gamma functions appear in the denominator, so we
606 // catch their harmless domain errors and set the terms to zero.
608 _Tp __sgn_g1ca = _Tp(0), __ln_g1ca = _Tp(0);
609 _Tp __sgn_g1cb = _Tp(0), __ln_g1cb = _Tp(0);
612 __sgn_g1ca = __log_gamma_sign(__c - __a);
613 __ln_g1ca = __log_gamma(__c - __a);
614 __sgn_g1cb = __log_gamma_sign(__c - __b);
615 __ln_g1cb = __log_gamma(__c - __b);
623 _Tp __sgn_g2a = _Tp(0), __ln_g2a = _Tp(0);
624 _Tp __sgn_g2b = _Tp(0), __ln_g2b = _Tp(0);
627 __sgn_g2a = __log_gamma_sign(__a);
628 __ln_g2a = __log_gamma(__a);
629 __sgn_g2b = __log_gamma_sign(__b);
630 __ln_g2b = __log_gamma(__b);
637 const _Tp __sgn_gc = __log_gamma_sign(__c);
638 const _Tp __ln_gc = __log_gamma(__c);
639 const _Tp __sgn_gd = __log_gamma_sign(__d);
640 const _Tp __ln_gd = __log_gamma(__d);
641 const _Tp __sgn_gmd = __log_gamma_sign(-__d);
642 const _Tp __ln_gmd = __log_gamma(-__d);
644 const _Tp __sgn1 = __sgn_gc * __sgn_gd * __sgn_g1ca * __sgn_g1cb;
645 const _Tp __sgn2 = __sgn_gc * __sgn_gmd * __sgn_g2a * __sgn_g2b;
650 _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
651 _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
652 + __d * std::log(_Tp(1) - __x);
653 if (__ln_pre1 < __log_max && __ln_pre2 < __log_max)
655 __pre1 = std::exp(__ln_pre1);
656 __pre2 = std::exp(__ln_pre2);
662 std::__throw_runtime_error(__N("Overflow of gamma functions "
663 "in __hyperg_reflect"));
666 else if (__ok1 && !__ok2)
668 _Tp __ln_pre1 = __ln_gc + __ln_gd - __ln_g1ca - __ln_g1cb;
669 if (__ln_pre1 < __log_max)
671 __pre1 = std::exp(__ln_pre1);
677 std::__throw_runtime_error(__N("Overflow of gamma functions "
678 "in __hyperg_reflect"));
681 else if (!__ok1 && __ok2)
683 _Tp __ln_pre2 = __ln_gc + __ln_gmd - __ln_g2a - __ln_g2b
684 + __d * std::log(_Tp(1) - __x);
685 if (__ln_pre2 < __log_max)
688 __pre2 = std::exp(__ln_pre2);
693 std::__throw_runtime_error(__N("Overflow of gamma functions "
694 "in __hyperg_reflect"));
701 std::__throw_runtime_error(__N("Underflow of gamma functions "
702 "in __hyperg_reflect"));
705 const _Tp __F1 = __hyperg_series(__a, __b, _Tp(1) - __d,
707 const _Tp __F2 = __hyperg_series(__c - __a, __c - __b, _Tp(1) + __d,
710 const _Tp __F = __pre1 * __F1 + __pre2 * __F2;
718 * @brief Return the hypogeometric function @f$ _2F_1(a,b;c;x) @f$.
720 * The hypogeometric function is defined by
722 * _2F_1(a,b;c;x) = \frac{\Gamma(c)}{\Gamma(a)\Gamma(b)}
723 * \sum_{n=0}^{\infty}
724 * \frac{\Gamma(a+n)\Gamma(b+n)}{\Gamma(c+n)}
728 * @param __a The first "numerator" parameter.
729 * @param __a The second "numerator" parameter.
730 * @param __c The "denominator" parameter.
731 * @param __x The argument of the confluent hypergeometric function.
732 * @return The confluent hypergeometric function.
734 template<typename _Tp>
736 __hyperg(const _Tp __a, const _Tp __b, const _Tp __c, const _Tp __x)
738 #if _GLIBCXX_USE_C99_MATH_TR1
739 const _Tp __a_nint = std::tr1::nearbyint(__a);
740 const _Tp __b_nint = std::tr1::nearbyint(__b);
741 const _Tp __c_nint = std::tr1::nearbyint(__c);
743 const _Tp __a_nint = static_cast<int>(__a + _Tp(0.5L));
744 const _Tp __b_nint = static_cast<int>(__b + _Tp(0.5L));
745 const _Tp __c_nint = static_cast<int>(__c + _Tp(0.5L));
747 const _Tp __toler = _Tp(1000) * std::numeric_limits<_Tp>::epsilon();
748 if (std::abs(__x) >= _Tp(1))
749 std::__throw_domain_error(__N("Argument outside unit circle "
751 else if (__isnan(__a) || __isnan(__b)
752 || __isnan(__c) || __isnan(__x))
753 return std::numeric_limits<_Tp>::quiet_NaN();
754 else if (__c_nint == __c && __c_nint <= _Tp(0))
755 return std::numeric_limits<_Tp>::infinity();
756 else if (std::abs(__c - __b) < __toler || std::abs(__c - __a) < __toler)
757 return std::pow(_Tp(1) - __x, __c - __a - __b);
758 else if (__a >= _Tp(0) && __b >= _Tp(0) && __c >= _Tp(0)
759 && __x >= _Tp(0) && __x < _Tp(0.995L))
760 return __hyperg_series(__a, __b, __c, __x);
761 else if (std::abs(__a) < _Tp(10) && std::abs(__b) < _Tp(10))
763 // For integer a and b the hypergeometric function is a finite polynomial.
764 if (__a < _Tp(0) && std::abs(__a - __a_nint) < __toler)
765 return __hyperg_series(__a_nint, __b, __c, __x);
766 else if (__b < _Tp(0) && std::abs(__b - __b_nint) < __toler)
767 return __hyperg_series(__a, __b_nint, __c, __x);
768 else if (__x < -_Tp(0.25L))
769 return __hyperg_luke(__a, __b, __c, __x);
770 else if (__x < _Tp(0.5L))
771 return __hyperg_series(__a, __b, __c, __x);
773 if (std::abs(__c) > _Tp(10))
774 return __hyperg_series(__a, __b, __c, __x);
776 return __hyperg_reflect(__a, __b, __c, __x);
779 return __hyperg_luke(__a, __b, __c, __x);
782 } // namespace std::tr1::__detail
784 /* @} */ // group tr1_math_spec_func
789 #endif // _GLIBCXX_TR1_HYPERGEOMETRIC_TCC