Esempio n. 1
0
    def test_fabs(self):
        from numpypy import array, fabs
        from math import fabs as math_fabs

        a = array([-5.0, -0.0, 1.0])
        b = fabs(a)
        for i in range(3):
            assert b[i] == math_fabs(a[i])
Esempio n. 2
0
    def test_fabs(self):
        from _numpypy import array, fabs
        from math import fabs as math_fabs

        a = array([-5.0, -0.0, 1.0])
        b = fabs(a)
        for i in range(3):
            assert b[i] == math_fabs(a[i])
Esempio n. 3
0
    def test_fabs(self):
        from _numpypy import array, fabs
        from math import fabs as math_fabs, isnan

        a = array([-5.0, -0.0, 1.0])
        b = fabs(a)
        for i in range(3):
            assert b[i] == math_fabs(a[i])
        assert fabs(float('inf')) == float('inf')
        assert fabs(float('-inf')) == float('inf')
        assert isnan(fabs(float('nan')))
Esempio n. 4
0
    def test_fabs(self):
        from _numpypy import array, fabs
        from math import fabs as math_fabs, isnan

        a = array([-5.0, -0.0, 1.0])
        b = fabs(a)
        for i in range(3):
            assert b[i] == math_fabs(a[i])
        assert fabs(float('inf')) == float('inf')
        assert fabs(float('-inf')) == float('inf')
        assert isnan(fabs(float('nan')))
Esempio n. 5
0
 def setDecimals(selforcls, newDecimals):
     if newDecimals is not None:
         testfor(
             isNumber(newDecimals) and newDecimals >= 0, DecimalsError,
             "Parameter decimals has to be a positive number!")
     else:
         start, end = selforcls._valueRange
         newDecimals = round(math_log10(math_fabs(end - start)))
     newDecimals = max(newDecimals, 0)
     newDecimals = min(newDecimals, sys.float_info.max_10_exp)
     selforcls._decimals = int(newDecimals)