我正在尝试计算到非常大的数字的最接近的2 ^ n(<= 10 ^ 19)
我试图使用math.log(number,2)。但这对于很大的数字给出了错误的结果。我应该如何在不使用其他库的情况下执行此操作?
a = 9843649374639837463 # a is any num between 1 and 10^9 number = int(math.log(a,2))
python floating-point precision logarithm python-3.x
floating-point ×1
logarithm ×1
precision ×1
python ×1
python-3.x ×1