# [Bug #781] Numeric#step \$B\$G(B step \$B\$H\$7\$F(B Infinity \$B\$r\$D\$+\$&\$H(B NaN \$B\$r@8@.\$9\$k\$3\$H\$

e\$B%A%1%C%He(B #781 e\$B\$,99?7\$5\$l\$^\$7\$?!#e(B (by tadayoshi funaba)

e\$BC1\$K3NG’\$G\$9\$,!“e(Bstep
e\$B\$,IbF0>.?tE@?t\$@\$H!”:G=i\$+\$iIbF0>.?tE@?t\$K\$J\$Ce(B
e\$B\$F\$\$\$F!"B>\$N>l9g\$H0c\$&\$h\$&\$K8+\$(\$^\$9!#\$3\$l\$O\$3\$&\$\$\$&\$b\$N\$G\$9\$+!#e(B

\$ ./ruby -e “p 0.step(3,1.0){|x| p [x, x.class]}”
[0.0, Float]
[1.0, Float]
[2.0, Float]
[3.0, Float]
0

\$ ./ruby -e “p 0.step(3,Rational(1)){|x| p [x, x.class]}”
[0, Fixnum]
[(1/1), Rational]
[(2/1), Rational]
[(3/1), Rational]
0

\$ ./ruby -rbigdecimal -e “p 0.step(3,BigDecimal(‘1’)){|x| p [x,
x.class]}”
[0, Fixnum]
[#BigDecimal:81b5d48,‘0.1E1’,4(12), BigDecimal]
[#BigDecimal:81b5bcc,‘0.2E1’,4(12), BigDecimal]
0

http://redmine.ruby-lang.org/issues/show/781

e\$B\$^\$D\$b\$He(B e\$B\$f\$-\$R\$m\$G\$9e(B

In message “Re: [ruby-dev:37188] [Bug #781] Numeric#step e\$B\$Ge(B step
e\$B\$H\$7\$Fe(B Infinity e\$B\$r\$D\$+\$&\$He(B NaN
e\$B\$r@8@.\$9\$k\$3\$H\$,\$”\$ke(B"
on Tue, 25 Nov 2008 23:39:19 +0900, tadayoshi funaba
[email protected] writes:

|e\$BC1\$K3NG’\$G\$9\$,!“e(Bstep e\$B\$,IbF0>.?tE@?t\$@\$H!”:G=i\$+\$iIbF0>.?tE@?t\$K\$J\$Ce(B
|e\$B\$F\$\$\$F!"B>\$N>l9g\$H0c\$&\$h\$&\$K8+\$(\$^\$9!#\$3\$l\$O\$3\$&\$\$\$&\$b\$N\$G\$9\$+!#e(B

beg, end,
stepe\$B\$N\$\$\$:\$l\$+\$,e(BFloate\$B\$@\$H\$<\$s\$Ve(BFloate\$B\$G7W;;\$7\$^\$9!#e(B
e\$B\$3\$l\$O\$=\$&\$\$\$&\$b\$N\$N\$D\$b\$j\$G\$9!#e(B