diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-19 20:10:13 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-19 20:10:13 +0000 |
commit | 63f2557b56ca791e9fee0fdeba4ad5f6aa378fe2 (patch) | |
tree | 6a8d6ec1a1bd88e986408c1848666f67df129df2 /complex.c | |
parent | c21b9570dc93293a80f1ff99db36c518ffdd9cb7 (diff) | |
download | ruby-63f2557b56ca791e9fee0fdeba4ad5f6aa378fe2.tar.gz |
* complex.c; edited rdoc.
* rational.c; ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -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) { |