diff options
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1498,7 +1498,6 @@ 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; @@ -1519,7 +1518,7 @@ 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), '.') || strchr(RSTRING_PTR(sr), 'e') || strchr(RSTRING_PTR(sr), 'E')) + else if (strpbrk(RSTRING_PTR(sr), ".eE")) r = f_to_f(sr); else r = f_to_i(sr); @@ -1527,7 +1526,7 @@ string_to_c_internal(VALUE self) if (!NIL_P(si)) { if (strchr(RSTRING_PTR(si), '/')) i = f_to_r(si); - else if (strchr(RSTRING_PTR(si), '.') || strchr(RSTRING_PTR(si), 'e') || strchr(RSTRING_PTR(si), 'E')) + else if (strpbrk(RSTRING_PTR(si), ".eE")) i = f_to_f(si); else i = f_to_i(si); |