aboutsummaryrefslogtreecommitdiffstats
path: root/complex.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-17 17:03:52 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-17 17:03:52 +0000
commit62f7e108e2e91bfb2c806f1badcdea59f7c8fbfe (patch)
tree604a1935c6e9534ab83bdd422e5097be99e4c079 /complex.c
parent8d05671d63b506f8e3db75db4db5631bc61d0fd2 (diff)
downloadruby-62f7e108e2e91bfb2c806f1badcdea59f7c8fbfe.tar.gz
* 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
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/complex.c b/complex.c
index f887ebeda9..8af4a5203d 100644
--- a/complex.c
+++ b/complex.c
@@ -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)