Ejemplo n.º 1
0
 def __init__(self, float_conv=float,int_conv=int,
              float_to_float=float,
              float_to_str = lambda v:'%24.16e' % v,
              title = 'Python floating point number'):
     """
       float_conv - convert integer to float (array)
       int_conv   - convert float (array) to integer
       float_to_float - convert float array to float
       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.
     with errstate(under='ignore'):
         self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
Ejemplo n.º 2
0
 def __init__(self, float_conv=float,int_conv=int,
              float_to_float=float,
              float_to_str = lambda v:'%24.16e' % v,
              title = 'Python floating point number'):
     """
       float_conv - convert integer to float (array)
       int_conv   - convert float (array) to integer
       float_to_float - convert float array to float
       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.
     with errstate(under='ignore'):
         self._do_init(float_conv, int_conv, float_to_float, float_to_str, title)
Ejemplo n.º 3
0
 def within_tol(x, y, atol, rtol):
     with errstate(invalid='ignore'):
         result = less_equal(abs(x - y), atol + rtol * abs(y))
     if isscalar(a) and isscalar(b):
         result = bool(result)
     return result