1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* complex.c (read_comp): modified handling of polar form.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2012-11-17 17:03:52 +00:00
parent 8d05671d63
commit 62f7e108e2
2 changed files with 8 additions and 5 deletions

View file

@ -1,3 +1,7 @@
Sun Nov 18 02:02:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
* complex.c (read_comp): modified handling of polar form.
Sun Nov 18 00:50:44 2012 Tadayoshi Funaba <tadf@dotrb.org>
* complex.c (read_comp): fixed handling of polar form.

View file

@ -1672,14 +1672,13 @@ read_comp(const char **s, int strict,
(*s)++;
bb = *b;
if (!(isdigit((unsigned char)**s) ||
**s == '-' || **s == '+' ||
**s == '.')) {
st = read_rat(s, strict, b);
**b = '\0';
if (strlen(bb) < 1 ||
!isdigit((unsigned char)*(bb + strlen(bb) - 1))) {
*ret = rb_complex_raw2(num, ZERO);
return 0; /* e.g. "1@x" */
}
st = read_rat(s, strict, b);
**b = '\0';
num2 = str2num(bb);
*ret = rb_complex_polar(num, num2);
if (!st)