From: Su Zhang Date: 2011-04-15T03:01:42+09:00 Subject: Re: Exclusive float range, Range#step result in counterintuitive result This looks like a bug to me. (The problem exists as of 1.9.2-p180.) In , `range_step' is the implementation of Range#step. It calls `ruby_float_step', which is implemented in , to handle float stepping. The call looks like this: else if (ruby_float_step(b, e, step, EXCL(range))) { /* done */ } The problem is that it passes the `exclude_end?' property of the range to `ruby_float_step', in our case it is false. Inside the implementation of `ruby_float_step' is something like: n = floor(n + err); if (!excl) n++; for (i=0; i [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] This works since `num_step', again implemented in , explicitly passes a false to excl: else if (!ruby_float_step(from, to, step, FALSE)) { ... -- Posted via http://www.ruby-forum.com/.