* complex.c (read_comp): fixed handling of polar form.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8f3882d0f8
commit
8d05671d63
@ -1,3 +1,7 @@
|
|||||||
|
Sun Nov 18 00:50:44 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* complex.c (read_comp): fixed handling of polar form.
|
||||||
|
|
||||||
Sun Nov 18 00:14:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
Sun Nov 18 00:14:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* complex.c (string_to_c_strict, string_to_c): rewrote without regexp.
|
* complex.c (string_to_c_strict, string_to_c): rewrote without regexp.
|
||||||
|
14
complex.c
14
complex.c
@ -1668,16 +1668,24 @@ read_comp(const char **s, int strict,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (**s == '@') {
|
if (**s == '@') {
|
||||||
|
int st;
|
||||||
|
|
||||||
(*s)++;
|
(*s)++;
|
||||||
bb = *b;
|
bb = *b;
|
||||||
if (!read_rat(s, strict, b)) {
|
if (!(isdigit((unsigned char)**s) ||
|
||||||
num = rb_complex_raw2(num, ZERO);
|
**s == '-' || **s == '+' ||
|
||||||
|
**s == '.')) {
|
||||||
|
*ret = rb_complex_raw2(num, ZERO);
|
||||||
return 0; /* e.g. "1@x" */
|
return 0; /* e.g. "1@x" */
|
||||||
}
|
}
|
||||||
|
st = read_rat(s, strict, b);
|
||||||
**b = '\0';
|
**b = '\0';
|
||||||
num2 = str2num(bb);
|
num2 = str2num(bb);
|
||||||
*ret = rb_complex_polar(num, num2);
|
*ret = rb_complex_polar(num, num2);
|
||||||
return 1; /* e.g. "1@2" */
|
if (!st)
|
||||||
|
return 0; /* e.g. "1@2." */
|
||||||
|
else
|
||||||
|
return 1; /* e.g. "1@2" */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (**s == '-' || **s == '+') {
|
if (**s == '-' || **s == '+') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user