Project

General

Profile

Actions

Bug #1328

closed

"p eval('0' + '+0.1'*n)" の挙動

Added by mrkn (Kenta Murata) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2009-03-29) [i386-darwin9.6.0]
Backport:

Description

=begin
"p eval('0'+'+0.1'*n)" を評価すると、n がある値 N を超えたときに
スタックが溢れますが、バージョン 1.9.2 の N が バージョン 1.9.1 より
小さくなっています。

$ ~/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 '
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0