Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获得无浮点数的sqrt天花板。Python 3.7.3_Python_Python 3.x_Python 3.7_Math.sqrt - Fatal编程技术网

获得无浮点数的sqrt天花板。Python 3.7.3

获得无浮点数的sqrt天花板。Python 3.7.3,python,python-3.x,python-3.7,math.sqrt,Python,Python 3.x,Python 3.7,Math.sqrt,我需要得到平方根的上限,例如10**10001(10^10001)。如果我这样做: from math import sqrt print(int(sqrt(10**10001))+1) 我看了一下,它给了我一个溢出错误。 更准确地说,一个 Traceback (most recent call last) File <stdin>, line 1, in <module> OverflowError: int too large to convert to flo

我需要得到平方根的上限,例如
10**10001
(10^10001)。如果我这样做:

from math import sqrt
print(int(sqrt(10**10001))+1)
我看了一下,它给了我一个
溢出错误
。 更准确地说,一个

Traceback (most recent call last)
  File <stdin>, line 1, in <module>
OverflowError: int too large to convert to float.
回溯(最近一次呼叫上次)
文件,第1行,在
OverflowerError:int太大,无法转换为float。
我需要一个整数作为答案。
溢出错误
来自
math.sqrt(x)
函数。
如果有人能提供帮助,我们将不胜感激。

数学模块具有天花板和地板功能


尝试打印(math.ceil(math.sqrt(NUMBER))

数学模块有一个ceil和floor函数


尝试打印(math.ceil(math.sqrt(NUMBER))

这是1加10000个零。为什么你需要这么大的数字?我需要计算非常大的数字,看看它们是否是素数。这能回答你的问题吗?这似乎是一个复制品。尝试导入十进制
print(int(decimal.decimal(10**10001).sqrt())+1)
问题是
print(int(sqrt(10*10001))+1)
,这是非常可计算的,可以打印
317
。那是打字错误吗?那是1加1万个零。为什么你需要这么大的数字?我需要计算非常大的数字,看看它们是否是素数。这能回答你的问题吗?这似乎是一个复制品。尝试导入十进制
print(int(decimal.decimal(10**10001).sqrt())+1)
问题是
print(int(sqrt(10*10001))+1)
,这是非常可计算的,可以打印
317
。这是打字错误吗?Int太大,无法转换为float。同样,sqrt函数!我需要计算
10**10001
的sqrt或1后跟10001个零。然后尝试math.ceil(math.sqrt(10)**10001)。应该修复int太大而无法转换为float的问题。同样,sqrt函数!我需要计算
10**10001
的sqrt或1后跟10001个零。然后尝试math.ceil(math.sqrt(10)**10001)。应该解决这个问题