def pow(x, n):
    r = 1.0

    if n < 0:
        x = 1.0/x
        n = -n

    for a, b in izip(square(x), int2digits(n, 2)):
        if b:
            r *= a

    return r
Beispiel #2
0
def isPalindrome(x):
    if x < 0:
        return False
    return x == digits2int_b(int2digits(x))
def isPalindrome(x):
    if x < 0:
        return False
    return x == digits2int_b(int2digits(x))
def reverse(x):
    n = sign(x) * digits2int_b(int2digits(abs(x)))
    return overflow32(n, 0, 0)