def test_modf(ctx_factory): context = ctx_factory() queue = cl.CommandQueue(context) for s in sizes: a = cl_array.arange(queue, s, dtype=np.float32) / 10 fracpart, intpart = clmath.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
def test_modf(ctx_getter): context = ctx_getter() queue = cl.CommandQueue(context) for s in sizes: a = cl_array.arange(context, queue, s, dtype=numpy.float32)/10 fracpart, intpart = clmath.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