Get ceiling of sqrt without float point. Python 3.7.3

1.2k Views Asked by At

I need to get the ceiling of a square root, such as 10**10001 (10^10001). If I do:

from math import sqrt
print(int(sqrt(10**10001))+1)

I look, and it gives me an OverflowError. More precisely, a

Traceback (most recent call last)
  File <stdin>, line 1, in <module>
OverflowError: int too large to convert to float.

I need a integer for an answer. The OverflowError is coming from the math.sqrt(x) function. If anybody can help, it would be appreciated.

1

There are 1 best solutions below

2
Parker Anderson On

the math module has a ceil and floor function

try print(math.ceil(math.sqrt(NUMBER)))