* lib/scanf.rb (extract_float): allow 2.e+2 style.

[ruby-dev:42452] #3978

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2010-10-26 12:39:33 +00:00
parent 767d70841a
commit 6ca3ad34a0
2 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Tue Oct 26 18:51:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
* lib/scanf.rb (extract_float): allow 2.e+2 style.
[ruby-dev:42452] #3978
Tue Oct 26 18:09:36 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* Makefile.in (ASFLAGS): needs INCFLAGS.

View File

@ -321,6 +321,8 @@ module Scanf
end
end
(sign == ?- ? -1 : 1) * Math.ldexp(f, exp.to_i)
elsif /\A([-+]?\d+)\.([eE][-+]\d+)/ =~ s
($1 << $2).to_f
else
s.to_f
end