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

ruby-changes:25725

From: tadf <ko1@a...>
Date: Wed, 21 Nov 2012 21:54:15 +0900 (JST)
Subject: [ruby-changes:25725] tadf:r37782 (trunk): * complex.c (nucomp_to_c): added.

tadf	2012-11-21 21:54:06 +0900 (Wed, 21 Nov 2012)

  New Revision: 37782

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

  Log:
    * complex.c (nucomp_to_c): added.

  Modified files:
    trunk/ChangeLog
    trunk/complex.c

Index: complex.c
===================================================================
--- complex.c	(revision 37781)
+++ complex.c	(revision 37782)
@@ -1474,6 +1474,21 @@
 
 /*
  * call-seq:
+ *    complex.to_c  ->  self
+ *
+ * Returns self.
+ *
+ *    Complex(2).to_c      #=> (2+0i)
+ *    Complex(-8, 6).to_c  #=> (-8+6i)
+ */
+static VALUE
+nucomp_to_c(VALUE self)
+{
+    return self;
+}
+
+/*
+ * call-seq:
  *    nil.to_c  ->  (0+0i)
  *
  * Returns zero as a complex.
@@ -2178,6 +2193,7 @@
     rb_define_method(rb_cComplex, "to_f", nucomp_to_f, 0);
     rb_define_method(rb_cComplex, "to_r", nucomp_to_r, 0);
     rb_define_method(rb_cComplex, "rationalize", nucomp_rationalize, -1);
+    rb_define_method(rb_cComplex, "to_c", nucomp_to_c, 0);
     rb_define_method(rb_cNilClass, "to_c", nilclass_to_c, 0);
     rb_define_method(rb_cNumeric, "to_c", numeric_to_c, 0);
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37781)
+++ ChangeLog	(revision 37782)
@@ -1,3 +1,7 @@
+Wed Nov 21 21:53:29 2012  Tadayoshi Funaba  <tadf@d...>
+
+	* complex.c (nucomp_to_c): added.
+
 Wed Nov 21 21:35:38 2012  Tadayoshi Funaba  <tadf@d...>
 
 	* include/ruby/util.h: removed extra semicolon in definition of

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

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