bug-gsl
[Top][All Lists]

## [Bug-gsl] Negative a or b in gsl_sf_hyperg_2F1_e()

 From: Evgeny Stambulchik Subject: [Bug-gsl] Negative a or b in gsl_sf_hyperg_2F1_e() Date: Tue, 12 Jul 2005 18:00:20 +0300 User-agent: Mozilla Thunderbird 1.0.2 (X11/20050328)

```Hello,

Since the 2F1 series is finite for either a or b being negative, this
should be used irrespectively of whether the absolute values are below
10.0 (why this specific value, BTW?).

The patch is attached.

Regards,

Evgeny
```
```--- hyperg_2F1.c.orig   2004-06-20 21:41:17.000000000 +0300
+++ hyperg_2F1.c        2005-07-12 17:56:47.000000000 +0300
@@ -656,17 +656,18 @@ gsl_sf_hyperg_2F1_e(double a, double b,
return hyperg_2F1_series(a, b, c, x, result);
}

+  /* Negative a or b result in finite series. */
+  if(a_neg_integer) {
+    return hyperg_2F1_series(rinta, b, c, x, result);
+  }
+  if(b_neg_integer) {
+    return hyperg_2F1_series(a, rintb, c, x, result);
+  }
+
if(fabs(a) < 10.0 && fabs(b) < 10.0) {
/* a and b are not too large, so we attempt
* variations on the series summation.
*/
-    if(a_neg_integer) {
-      return hyperg_2F1_series(rinta, b, c, x, result);
-    }
-    if(b_neg_integer) {
-      return hyperg_2F1_series(a, rintb, c, x, result);
-    }
-
if(x < -0.25) {
return hyperg_2F1_luke(a, b, c, x, result);
}
```