Permalink
Browse files

BUG: special: fix some mpmath-based tests by passing 'exact' fraction…

…s to mpmath so that its hypergeometric evaluation routines work correctly
  • Loading branch information...
pv committed Apr 2, 2010
1 parent 0309dcd commit a8ec049c7e96557465c0dc379037eeb6ecafa489
Showing with 11 additions and 5 deletions.
  1. +11 −5 scipy/special/tests/test_mpmath.py
@@ -95,12 +95,18 @@ def test_hyp2f1_some_points_2():
# Taken from mpmath unit tests -- this point failed for mpmath 0.13 but
# was fixed in their SVN since then
pts = [
- (112, 51./10, -9./10, -0.99999),
- ## Mpmath currently (0.13) fails also for these:
- #(10,-900,10.5,0.99),
- #(10,-900,-10.5,0.99),
+ (112, (51,10), (-9,10), -0.99999),
+ (10,-900,10.5,0.99),
+ (10,-900,-10.5,0.99),
]
- dataset = [p + (float(mpmath.hyp2f1(*p)),) for p in pts]
+
+ def fev(x):
+ if isinstance(x, tuple):
+ return float(x[0]) / x[1]
+ else:
+ return x
+
+ dataset = [tuple(map(fev, p)) + (float(mpmath.hyp2f1(*p)),) for p in pts]
dataset = np.array(dataset, dtype=np.float_)
FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-10).check()

0 comments on commit a8ec049

Please sign in to comment.