def test__x_divrem(self): x = 12345678901234567890L for i in range(100): y = long(randint(0, 1 << 30)) y <<= 30 y += randint(0, 1 << 30) f1 = rbigint.fromlong(x) f2 = rbigint.fromlong(y) div, rem = lobj._x_divrem(f1, f2) assert div.tolong(), rem.tolong() == divmod(x, y)
def test__divrem(self): x = 12345678901234567890L for i in range(100): y = long(randint(0, 1 << 30)) y <<= 30 y += randint(0, 1 << 30) for sx, sy in (1, 1), (1, -1), (-1, -1), (-1, 1): sx *= x sy *= y f1 = rbigint.fromlong(sx) f2 = rbigint.fromlong(sy) div, rem = lobj._x_divrem(f1, f2) assert div.tolong(), rem.tolong() == divmod(sx, sy)