Skip to content

Commit

Permalink
* lib/scanf.rb (extract_float): allow 2.e+2 style.
Browse files Browse the repository at this point in the history
  [ruby-dev:42452] ruby#3978

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Oct 26, 2010
1 parent 767d708 commit 6ca3ad3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Tue Oct 26 18:51:00 2010 NARUSE, Yui <[email protected]>

* lib/scanf.rb (extract_float): allow 2.e+2 style.
[ruby-dev:42452] #3978

Tue Oct 26 18:09:36 2010 Nobuyoshi Nakada <[email protected]>

* Makefile.in (ASFLAGS): needs INCFLAGS.
Expand Down
2 changes: 2 additions & 0 deletions lib/scanf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ def extract_float(s)
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
Expand Down

0 comments on commit 6ca3ad3

Please sign in to comment.