CrazyEd, it must not be able to represent 2 as an exact value. You see 2 on the screen, but it really means 1.9999999

Some integer values can be represented exactly, some can’t. To know which is which you’d have to get into details of the floating point representation.

I’m actually not sure if for i=i,j,1 always works or not now that I think about it.

actually for x=i,j,1 should always work because integers are exact. In your example it’s not the 2 that can’t be represented exactly, it’s probably the 0.1 increment that can’t.

Many thanks for your answers. This leads me to the conclusion to avoid using the step option in a for loop. Better doing that in an old fashioned way: use a pure integer loop, and calculate the required step inside the loop. This will guarantee that length of vectors is 100% predictable.