I recently came across this apparent inconsistency when going through someone's IDL code:
IDL> for i=0.,1.9,1. do print,i
0.00000
1.00000
IDL> for i=0.,1.9,1 do print,i
0.00000
1.00000
IDL> for i=0.,1.9 do print,i
0.00000
1.00000
2.00000
Could anyone explain if there is a logic behind the behaviour in the third loop.
The IDL version used is 8.2.0.
(Note that my own code would stick to using integers in a for loop, and definitely after finding this.)
This might be a bug in IDL 8.2 - when I run the commands in version 8.2.1 I get the same behaviour as you. When I run them on a different computer with version 8.0 I get the expected behaviour, i.e. each command gives the same output. The inbuilt IDL help certainly suggests that they should all give the same output.