示例#1
0
 def test_modf(self):
     """tests if the modf function works"""
     a = simplearray.array(test_sample).fill_arange()/10  
     b = cumath.modf(a)
 
     first = b[0]
     second = b[1]    
     
     for i in range(test_sample):
         c = math.modf(a[i])
         
         self.assert_(c[0] == first[i])
         self.assert_(c[1] == second[i])
示例#2
0
    def test_modf(self):
        """tests if the modf function works"""
        for s in sizes:
            a = gpuarray.arange(s, dtype=np.float32) / 10
            fracpart, intpart = cumath.modf(a)

            a = a.get()
            intpart = intpart.get()
            fracpart = fracpart.get()

            for i in range(s):
                fracpart_true, intpart_true = math.modf(a[i])

                assert intpart_true == intpart[i]
                assert abs(fracpart_true - fracpart[i]) < 1e-4
示例#3
0
    def test_modf(self):
        """tests if the modf function works"""
        for s in sizes:
            a = gpuarray.arange(s, dtype=np.float32)/10
            fracpart, intpart = cumath.modf(a)

            a = a.get()
            intpart = intpart.get()
            fracpart = fracpart.get()

            for i in range(s):
                fracpart_true, intpart_true = math.modf(a[i])

                assert intpart_true == intpart[i]
                assert abs(fracpart_true - fracpart[i]) < 1e-4