I’m trying to make a tetration calculator and it works until I do a number just slightly too big and it gives me the outrageous exponent error. How can I prevent this? Here is my code:
start_time = time.time()
base = gmpy2.mpz(inputList[1])
iterations = int(inputList[2])
result = base
for _ in range(1, iterations):
result = base ** result
print(result)
print(f"Took {time.time() - start_time} seconds to calculate.")
submitted by /u/ghostjusr
[link] [comments]
r/learnpython I’m trying to make a tetration calculator and it works until I do a number just slightly too big and it gives me the outrageous exponent error. How can I prevent this? Here is my code: start_time = time.time() base = gmpy2.mpz(inputList[1]) iterations = int(inputList[2]) result = base for _ in range(1, iterations): result = base ** result print(result) print(f”Took {time.time() – start_time} seconds to calculate.”) submitted by /u/ghostjusr [link] [comments]
I’m trying to make a tetration calculator and it works until I do a number just slightly too big and it gives me the outrageous exponent error. How can I prevent this? Here is my code:
start_time = time.time()
base = gmpy2.mpz(inputList[1])
iterations = int(inputList[2])
result = base
for _ in range(1, iterations):
result = base ** result
print(result)
print(f"Took {time.time() - start_time} seconds to calculate.")
submitted by /u/ghostjusr
[link] [comments]