It can be strange when I tried to run a program and I found something unexplainable.
import numpy as np
j = 0
start = 0.2
end = 0.8
step = 0.01
for i in np.arange(start, end, step):
print('i is ', i)
print('i is bigger than end is', i > end)
print('j is ', j)
print(' ')
j+=1
The outcome shows that the last i is bigger than the upper bound???
I tried many other combinations of start and end, but they all seemed to be normal. So why does this happen when the lower bound is 0.2 and the upper bound is 0.8? Is there anything about np.arange that I don't know? Or maybe the fractional part somehow affect the outcome? (btw, I know that there are plenty of ways to fix this, just be curious)