ruby-changes:24941
From: zzak <ko1@a...>
Date: Thu, 20 Sep 2012 07:23:47 +0900 (JST)
Subject: [ruby-changes:24941] zzak:r36993 (trunk): * complex.c: Examples for Complex Documentation.
zzak 2012-09-20 07:23:15 +0900 (Thu, 20 Sep 2012) New Revision: 36993 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36993 Log: * complex.c: Examples for Complex Documentation. Patch by Robin Dupret. Fixes #184 on github. Modified files: trunk/ChangeLog trunk/complex.c Index: complex.c =================================================================== --- complex.c (revision 36992) +++ complex.c (revision 36993) @@ -440,6 +440,10 @@ * Complex.rectangular(real[, imag]) -> complex * * Returns a complex object which denotes the given rectangular form. + * + * For example: + * Complex.rect(12, 2) # => (12+2i) + * Complex.rect(0, 17) # => (0+17i) */ static VALUE nucomp_s_new(int argc, VALUE *argv, VALUE klass) @@ -679,7 +683,11 @@ * call-seq: * cmp + numeric -> complex * - * Performs addition. + * Performs addition on the first member of the Complex. + * + * Complex(5, 2) + 3 # => (8+2i) + * Complex(11, 3) + 4 # => (15+3i) + * */ static VALUE nucomp_add(VALUE self, VALUE other) @@ -691,7 +699,10 @@ * call-seq: * cmp - numeric -> complex * - * Performs subtraction. + * Performs subtraction on the first member of the Complex. + * + * Complex(33, 12) - 10 # => (23+12i) + * Complex(12.4, 3.5) - 5 # => (7.4+3.5i) */ static VALUE nucomp_sub(VALUE self, VALUE other) @@ -703,7 +714,10 @@ * call-seq: * cmp * numeric -> complex * - * Performs multiplication. + * Performs multiplication on the two members. + * + * Complex(78, 58) * 10 # => (780+580i) + * Complex(5.6, 3.4) * 10 # => (56+34i) */ static VALUE nucomp_mul(VALUE self, VALUE other) Index: ChangeLog =================================================================== --- ChangeLog (revision 36992) +++ ChangeLog (revision 36993) @@ -1,3 +1,9 @@ +Thu Sep 20 07:20:00 2012 Zachary Scott <zzak@r...> + + * complex.c: Examples for Complex Documentation. + Patch by Robin Dupret. + Fixes #184 on github. + Thu Sep 20 07:15:00 2012 Zachary Scott <zzak@r...> * ext/ripper/lib/ripper.rb: Documentation for Ripper. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/