Package: python-scipy / 0.18.1-2

cap-ld-precision.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 3b5b60d25b512f7e29947b758d7c766054750de0 Mon Sep 17 00:00:00 2001
From: Julian Taylor <jtaylor.debian@googlemail.com>
Date: Mon, 12 Oct 2015 15:17:24 -0700
Subject: cap the decimal precision

 np.finfo returns 75 or nonconvergence RuntimeError on ppc
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702169

Patch-Name: cap-ld-precision.patch
---
 scipy/linalg/tests/test_basic.py       | 14 ++++++++++++--
 scipy/signal/tests/test_signaltools.py | 10 +++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/scipy/linalg/tests/test_basic.py b/scipy/linalg/tests/test_basic.py
index 7ca8387..3802260 100644
--- a/scipy/linalg/tests/test_basic.py
+++ b/scipy/linalg/tests/test_basic.py
@@ -1128,13 +1128,23 @@ class TestVectorNorms(object):
     def test_types(self):
         for dtype in np.typecodes['AllFloat']:
             x = np.array([1,2,3], dtype=dtype)
-            tol = max(1e-15, np.finfo(dtype).eps.real * 20)
+            # does not converge on ppc for float128
+            try:
+                eps = np.finfo(dtype).eps.real
+            except RuntimeError:
+                eps = 1e-19
+            tol = max(1e-15, eps * 20)
             assert_allclose(norm(x), np.sqrt(14), rtol=tol)
             assert_allclose(norm(x, 2), np.sqrt(14), rtol=tol)
 
         for dtype in np.typecodes['Complex']:
             x = np.array([1j,2j,3j], dtype=dtype)
-            tol = max(1e-15, np.finfo(dtype).eps.real * 20)
+            # does not converge on ppc for float128
+            try:
+                eps = np.finfo(dtype).eps.real
+            except RuntimeError:
+                eps = 1e-19
+            tol = max(1e-15, eps * 20)
             assert_allclose(norm(x), np.sqrt(14), rtol=tol)
             assert_allclose(norm(x, 2), np.sqrt(14), rtol=tol)
 
diff --git a/scipy/signal/tests/test_signaltools.py b/scipy/signal/tests/test_signaltools.py
index 95a330a..f9866b5 100644
--- a/scipy/signal/tests/test_signaltools.py
+++ b/scipy/signal/tests/test_signaltools.py
@@ -1258,7 +1258,15 @@ class TestCorrelate2d(TestCase):
 # name will be TestCorrelateComplex###, where ### is the number of bits.
 for datatype in [np.csingle, np.cdouble, np.clongdouble]:
     cls = _get_testcorrelate_class(datatype, _TestCorrelateComplex)
-    cls.decimal = int(2 * np.finfo(datatype).precision / 3)
+    # will either return a too large value for longdouble
+    # or nonconvergence RuntimeError see #702169
+    try:
+        cls.decimal = int(2 * np.finfo(datatype).precision / 3)
+        if cls.decimal > 25:
+            cls.decimal = 14
+    except RuntimeError:
+          cls.decimal = 14
+
     globals()[cls.__name__] = cls