8000 Bug#4655 by tinco · Pull Request #16 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Bug#4655 #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
Prev Previous commit
parse scientific notation numbers as float instead of as int
  • Loading branch information
tinco committed May 9, 2011
commit 0ecf5611aa3314c7b5d69f7743c5b8af65dad0c9
5 changes: 3 additions & 2 deletions complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,7 @@ string_to_c_internal(VALUE self)
m = f_match(comp_pat2, s);
if (NIL_P(m))
return rb_assoc_new(Qnil, self);
// string is of form "x+yi"
sr = f_aref(m, INT2FIX(1));
if (NIL_P(f_aref(m, INT2FIX(2))))
si = Qnil;
Expand All @@ -1518,15 +1519,15 @@ string_to_c_internal(VALUE self)
if (!NIL_P(sr)) {
if (strchr(RSTRING_PTR(sr), '/'))
r = f_to_r(sr);
else if (strchr(RSTRING_PTR(sr), '.'))
else if (strchr(RSTRING_PTR(sr), '.') || strchr(RSTRING_PTR(sr), 'e') || strchr(RSTRING_PTR(sr), 'E'))
r = f_to_f(sr);
else
r = f_to_i(sr);
}
if (!NIL_P(si)) {
if (strchr(RSTRING_PTR(si), '/'))
i = f_to_r(si);
else if (strchr(RSTRING_PTR(si), '.'))
else if (strchr(RSTRING_PTR(si), '.') || strchr(RSTRING_PTR(si), 'e') || strchr(RSTRING_PTR(si), 'E'))
i = f_to_f(si);
else
i = f_to_i(si);
Expand Down
0