1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
def (num): if abs(num - 0.0) < 0.0000001: return True
def power(base, exponent): if equal_zero(base): result = False if exponent == 0: result = 1 result = power(base, abs(exponent) >> 1) result *= result if abs(exponent) & 1 == 1: result *= base if exponent < 0: result = 1.0 / result return result
power_value(2, 2)
|
近期评论