[前][次][番号順一覧][スレッド一覧]

ruby-changes:25647

From: tadf <ko1@a...>
Date: Sun, 18 Nov 2012 00:54:27 +0900 (JST)
Subject: [ruby-changes:25647] tadf:r37704 (trunk): * complex.c (read_comp): fixed handling of polar form.

tadf	2012-11-18 00:51:55 +0900 (Sun, 18 Nov 2012)

  New Revision: 37704

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37704

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

  Modified files:
    trunk/ChangeLog
    trunk/complex.c

Index: complex.c
===================================================================
--- complex.c	(revision 37703)
+++ complex.c	(revision 37704)
@@ -1668,16 +1668,24 @@
     }
 
     if (**s == '@') {
+	int st;
+
 	(*s)++;
 	bb = *b;
-	if (!read_rat(s, strict, b)) {
-	    num = rb_complex_raw2(num, ZERO);
+	if (!(isdigit((unsigned char)**s) ||
+	      **s == '-' || **s == '+' ||
+	      **s == '.')) {
+	    *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);
-	return 1; /* e.g. "1@2" */
+	if (!st)
+	    return 0; /* e.g. "1@2." */
+	else
+	    return 1; /* e.g. "1@2" */
     }
 
     if (**s == '-' || **s == '+') {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37703)
+++ ChangeLog	(revision 37704)
@@ -1,3 +1,7 @@
+Sun Nov 18 00:50:44 2012  Tadayoshi Funaba  <tadf@d...>
+
+	* complex.c (read_comp): fixed handling of polar form.
+
 Sun Nov 18 00:14:46 2012  Tadayoshi Funaba  <tadf@d...>
 
 	* complex.c (string_to_c_strict, string_to_c): rewrote without regexp.

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]