summaryrefslogtreecommitdiff
path: root/numpy/lib/machar.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2008-04-29 15:39:23 +0000
committerDavid Cournapeau <cournape@gmail.com>2008-04-29 15:39:23 +0000
commit59e7bda0f6d189428b7268e0150709bacde8544b (patch)
treec3245f5023b44ed3e8d8e059fc9a119d5fc4ca36 /numpy/lib/machar.py
parent240d9a2236213e5439a89bf51cfaf0257bf85729 (diff)
downloadnumpy-59e7bda0f6d189428b7268e0150709bacde8544b.tar.gz
Disable underflow warning reporting when testing for arch + test (#759).
Diffstat (limited to 'numpy/lib/machar.py')
-rw-r--r--numpy/lib/machar.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/machar.py b/numpy/lib/machar.py
index 9d0e08e45..72fde37f2 100644
--- a/numpy/lib/machar.py
+++ b/numpy/lib/machar.py
@@ -8,6 +8,7 @@ floating-point arithmetic system
__all__ = ['MachAr']
from numpy.core.fromnumeric import any
+from numpy.core.numeric import seterr
# Need to speed this up...especially for longfloat
@@ -58,6 +59,15 @@ class MachAr(object):
float_to_str - convert array float to str
title - description of used floating point numbers
"""
+ # We ignore all errors here because we are purposely triggering
+ # underflow to detect the properties of the runninng arch.
+ saverrstate = seterr(under='ignore')
+ try:
+ self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
+ finally:
+ seterr(**saverrstate)
+
+ def _do_init(self, float_conv, int_conv, float_to_float, float_to_str, title):
max_iterN = 10000
msg = "Did not converge after %d tries with %s"
one = float_conv(1)