[Bug #1328] "p eval('0' + '+0.1'*n)" $B$N5sF0(B


#1

Bug #1328: “p eval(‘0’ + ‘+0.1’*n)” e$B$N5sF0e(B
http://redmine.ruby-lang.org/issues/show/1328

e$B5/I<<Te(B: Kenta M.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
e$B%+%F%4%je(B: core, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-03-29) [i386-darwin9.6.0]

“p eval(‘0’+’+0.1’*n)” e$B$rI>2A$9$k$H!“e(Bn e$B$,$”$kCMe(B N
e$B$rD6$($?$H$-$Ke(B
e$B%9%?%C%/$,0n$l$^$9$,!"%P!<%8%g%se(B 1.9.2 e$B$Ne(B N e$B$,e(B
e$B%P!<%8%g%se(B 1.9.1 e$B$h$je(B
e$B>.$5$/$J$C$F$$$^$9!#e(B

$ ~/ruby-1.9.1-r22762/bin/ruby -ve “p eval(‘0’+’+0.1’*13093)”
ruby 1.9.1p0 (2009-03-04 revision 22762) [i386-darwin9.6.0]
1309.2999999999
$ ~/ruby-1.9.1-r22762/bin/ruby -ve “p eval(‘0’+’+0.1’*13094)”
ruby 1.9.1p0 (2009-03-04 revision 22762) [i386-darwin9.6.0]
-e:1:in eval': stack level too deep (SystemStackError) from -e:1:in

$ ~/ruby-1.9.2-r23093/bin/ruby -ve “p eval(‘0’+’+0.1’*7481)”
ruby 1.9.2dev (2009-03-29) [i386-darwin9.6.0]
748.10000000010155
$ ~/ruby-1.9.2-r23093/bin/ruby -ve “p eval(‘0’+’+0.1’*7482)”
ruby 1.9.2dev (2009-03-29) [i386-darwin9.6.0]
-e:1:in eval': stack level too deep (SystemStackError) from -e:1:in


#2

e$B$J$+$@$G$9!#e(B

At Mon, 30 Mar 2009 05:50:40 +0900,
Kenta M. wrote in [ruby-dev:38207]:

“p eval(‘0’+’+0.1’*n)” e$B$rI>2A$9$k$H!“e(Bn e$B$,$”$kCMe(B N e$B$rD6$($?$H$-$Ke(B
e$B%9%?%C%/$,0n$l$^$9$,!"%P!<%8%g%se(B 1.9.2 e$B$Ne(B N e$B$,e(B e$B%P!<%8%g%se(B 1.9.1 e$B$h$je(B
e$B>.$5$/$J$C$F$$$^$9!#e(B

e$B:F8=$G$-$^$;$s$G$7$?!#e(B

$ ./ruby -ve “p eval(‘0’+’+0.1’*6714)”
ruby 1.9.2dev (2009-03-30 trunk 23097) [i386-darwin9.0]
671.40000000008411

$ ./ruby -ve “p eval(‘0’+’+0.1’*6715)”
ruby 1.9.1p0 (2009-03-04 revision 22762) [i386-darwin9.6.0]
-e:1:in eval': stack level too deep (SystemStackError) from -e:1:in

748.10000000010155
$ ~/ruby-1.9.2-r23093/bin/ruby -ve “p eval(‘0’+’+0.1’*7482)”
ruby 1.9.2dev (2009-03-29) [i386-darwin9.6.0]
-e:1:in eval': stack level too deep (SystemStackError) from -e:1:in

e$B$=$l$>$l$N%3%s%Q%$%k%*%W%7%g%s$OF1$8$G$7$g$&$+!#e(B


#3

e$B$`$i$?$G$9!#e(B

On 2009/03/30, at 12:47, Nobuyoshi N. wrote:

$ ./ruby -ve “p eval(‘0’+’+0.1’*6714)”

1309.2999999999
-e:1:in eval': stack level too deep (SystemStackError) from -e:1:in

e$B$=$l$>$l$N%3%s%Q%$%k%*%W%7%g%s$OF1$8$G$7$g$&$+!#e(B

configure e$B;~$Ke(B CFLAGS e$BEy$OFC$K;XDj$7$F$$$^$;$s$N$G!"e(B
e$B%3%s%Q%$%k%*%W%7%g%s$O3F%P!<%8%g%s$N%G%U%)%k%H$,;XDj$5$l$F$$$^$9!#e(B

$ ~/ruby-1.9.2-r23093/bin/ruby -rrbconfig -ve ‘p
Config::CONFIG[“CFLAGS”]’
ruby 1.9.2dev (2009-03-29) [i386-darwin9.6.0]
" -O3 -g -Wall -Wno-unused-parameter -Wno-parentheses -Wno-missing-
field-initializers -Wshorten-64-to-32 -Wpointer-arith -Wwrite-strings -
fno-common -pipe"

$ ~/ruby-1.9.1-r22762/bin/ruby -rrbconfig -ve ‘p
Config::CONFIG[“CFLAGS”]’
ruby 1.9.1p0 (2009-03-04 revision 22762) [i386-darwin9.6.0]
" -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common"

e$B1F6A$7$=$&$J0c$$$Oe(B -O2 e$B$+$ie(B -O3 e$B$KJQ$o$C$?$H$3$me(B
e$B$/$i$$$G$7$g$&$+!#e(B