From 59e7bda0f6d189428b7268e0150709bacde8544b Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Tue, 29 Apr 2008 15:39:23 +0000 Subject: Disable underflow warning reporting when testing for arch + test (#759). --- numpy/lib/machar.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'numpy/lib/machar.py') 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) -- cgit v1.2.1