Python 将np.arange中的射程增加1,则将射程增加2

Python 将np.arange中的射程增加1,则将射程增加2,python,numpy,Python,Numpy,我不确定这是一个bug还是我做错了什么。我有以下代码: r_div = 200 r_max = 1.4 numMax=.84 lowerBin = int((numMax - .2)/(r_max/r_div)) upperBin = int((numMax + .2)/(r_max/r_div)) k =np.arange((r_max/r_div)*lowerBin,(r_max/r_div)*(upperBin+1),r_max/r_div) 当我运行np.shape(k)时,我得到

我不确定这是一个bug还是我做错了什么。我有以下代码:

r_div = 200
r_max = 1.4
numMax=.84

lowerBin = int((numMax - .2)/(r_max/r_div))
upperBin = int((numMax + .2)/(r_max/r_div))

k =np.arange((r_max/r_div)*lowerBin,(r_max/r_div)*(upperBin+1),r_max/r_div)
当我运行np.shape(k)时,我得到(59)。现在,如果我在最后一行将上限更改为1:

k =np.arange((r_max/r_div)*lowerBin,(r_max/r_div)*(upperBin),r_max/r_div)

再次运行np.shape(k),它给我57。我不太清楚为什么它会变为2,而我只是将arange的上限变为1。

来自
arange
文档:

arange([start,] stop[, step,], dtype=None)

....

When using a non-integer step, such as 0.1, the results will often not
be consistent.  It is better to use `numpy.linspace` for these cases.

arange
docs:

arange([start,] stop[, step,], dtype=None)

....

When using a non-integer step, such as 0.1, the results will often not
be consistent.  It is better to use `numpy.linspace` for these cases.

浮点精度?与。浮点精度有关?与……有关。