I'm trying to use linspace
to equally space a closed interval. My code is as next:
for i in np.linspace(-1,2,6,endpoint=True):
print(i)
and its out put as next:
-1.0
-0.4
0.19999999999999996
0.7999999999999998
1.4
2.0
My question is about why linspace gives back 0.19999999999999996
and 0.7999999999999998
in the third and fourth places. As far as I understand linspace would increment the starting value with a rational number and as so it could be precisely represent all the values.
Am I right or I totally misunderstand something?