From: Vladimir Sizikov Date: 2008-03-23T23:56:10+09:00 Subject: Recent changes in Range#step behavior Hi, Since after MRI 1.8.6 patchlevel 111, there were some changes in Range#step, and I'm not sure they are intentional or not, so I'd like to clarify. Here's an example: ruby -v -e '(1.0..5.0).step(1.5) { |x| p x }' With MRI 1.8.6 patchlevel 111, the output is: ruby 1.8.6 (2007-09-24 patchlevel 111) [i686-linux] 1.0 2.5 4.0 With recent 1.8 branch: 1.0 2.0 3.0 4.0 5.0 With trunk (1.9): ruby 1.9.0 (2008-03-11 revision 0) [i686-linux] 1.0 2.0 3.0 4.0 5.0 As you see, now Range#step first converts the argument to integer, and then adds it during every iteration. (Btw, this whole behaviour of using the argument not as a step, but as an increment, is completely unspecified in the docs). For floats, the new behavior leads to loss of precision, since step is always integer (or converted to one). So, the question is: is the current trunk behavior is regression or intentional? Thanks, --Vladimir