From 63f2557b56ca791e9fee0fdeba4ad5f6aa378fe2 Mon Sep 17 00:00:00 2001 From: tadf Date: Fri, 19 Jun 2009 20:10:13 +0000 Subject: * complex.c; edited rdoc. * rational.c; ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- complex.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'complex.c') diff --git a/complex.c b/complex.c index c15c9a863c..3ebbbd3f6e 100644 --- a/complex.c +++ b/complex.c @@ -814,10 +814,6 @@ nucomp_equal_p(VALUE self, VALUE other) return f_equal_p(other, self); } -/* - * call-seq: - * cmp.coerce(numeric) => array - */ static VALUE nucomp_coerce(VALUE self, VALUE other) { @@ -1315,6 +1311,24 @@ make_patterns(void) #define id_gsub_bang rb_intern("gsub!") #define f_gsub_bang(x,y,z) rb_funcall(x, id_gsub_bang, 2, y, z) +/* + * call-seq: + * string.to_c => complex + * + * Returns a complex which denotes string form. + * + * For example: + * + * '9'.to_c #=> (9+0i) + * '-3/2'.to_c #=> ((-3/2)+0i) + * '-i'.to_c #=> (0-1i) + * '45i'.to_c #=> (0+45i) + * '3-4i'.to_c #=> (3-4i) + * '-4e2-4e-2i'.to_c #=> (-400.0-0.04i) + * '-0.0-0.0i'.to_c #=> (-0.0-0.0i) + * '1/2+3/4i'.to_c #=> ((1/2)+(3/4)*i) + * 'ruby'.to_c #=> (0+0i) + */ static VALUE string_to_c_internal(VALUE self) { -- cgit v1.2.3