double hyperg(double a, double b, double x) { double asum, psum, acanc, pcanc = 0, temp; /* See if a Kummer transformation will help */ temp = b - a; if (fabs(temp) < 0.001 * fabs(a)) return(exp(x) * hyperg(temp, b, -x)); psum = hy1f1p(a, b, x, &pcanc); if (pcanc < 1.0e-15) goto done; /* try asymptotic series */ asum = hy1f1a(a, b, x, &acanc); /* Pick the result with less estimated error */ if (acanc < pcanc) { pcanc = acanc; psum = asum; } done: if (pcanc > 1.0e-12) { it_warning("hyperg(): partial loss of precision"); } return(psum); }
double hyperg (double a, double b, double x) { double asum, psum, acanc, temp, pcanc = 0; /* See if a Kummer transformation will help */ temp = b - a; if (fabs(temp) < 0.001 * fabs(a)) return exp(x) * hyperg(temp, b, -x); psum = hy1f1p(a, b, x, &pcanc); if (pcanc < 1.0e-15) goto done; /* try asymptotic series */ asum = hy1f1a(a, b, x, &acanc); /* Pick the result with less estimated error */ if (acanc < pcanc) { pcanc = acanc; psum = asum; } done: if (pcanc > 1.0e-12) mtherr("hyperg", CEPHES_PLOSS); return psum; }