I encountered a question when I wanted to generate a numpy array using numpy.arange. For example, I want to generate an array that contains 3862 elements:
array1=numpy.arange(3.5678,3.5678+3862*0.0001,0.0001)
But the shape of array1 is (3863,)
. And what made me more confused is this:
In:
numpy.arange(3.5678,3.5678+3860*0.0001,0.0001).shape
numpy.arange(3.5678,3.5678+3861*0.0001,0.0001).shape
numpy.arange(3.5678,3.5678+3862*0.0001,0.0001).shape
numpy.arange(3.5678,3.5678+3863*0.0001,0.0001).shape
Out:
(3861,);(3861,);(3863,);(3863,)
Why did this happen? Due to the precision?
Many thanks!