@@ -440,6 +440,10 @@ nucomp_s_canonicalize_internal(VALUE klass, VALUE real, VALUE imag)
440
440
* Complex.rectangular(real[, imag]) -> complex
441
441
*
442
442
* Returns a complex object which denotes the given rectangular form.
443
+ *
444
+ * For example:
445
+ * Complex.rect(12, 2) # => (12+2i)
446
+ * Complex.rect(0, 17) # => (0+17i)
443
447
*/
444
448
static VALUE
445
449
nucomp_s_new (int argc , VALUE * argv , VALUE klass )
@@ -679,7 +683,11 @@ f_addsub(VALUE self, VALUE other,
679
683
* call-seq:
680
684
* cmp + numeric -> complex
681
685
*
682
- * Performs addition.
686
+ * Performs addition on the first member of the Complex.
687
+ *
688
+ * Complex(5, 2) + 3 # => (8+2i)
689
+ * Complex(11, 3) + 4 # => (15+3i)
690
+ *
683
691
*/
684
692
static VALUE
685
693
nucomp_add (VALUE self , VALUE other )
@@ -691,7 +699,10 @@ nucomp_add(VALUE self, VALUE other)
691
699
* call-seq:
692
700
* cmp - numeric -> complex
693
701
*
694
- * Performs subtraction.
702
+ * Performs subtraction on the first member of the Complex.
703
+ *
704
+ * Complex(33, 12) - 10 # => (23+12i)
705
+ * Complex(12.4, 3.5) - 5 # => (7.4+3.5i)
695
706
*/
696
707
static VALUE
697
708
nucomp_sub (VALUE self , VALUE other )
@@ -703,7 +714,10 @@ nucomp_sub(VALUE self, VALUE other)
703
714
* call-seq:
704
715
* cmp * numeric -> complex
705
716
*
706
- * Performs multiplication.
717
+ * Performs multiplication on the two members.
718
+ *
719
+ * Complex(78, 58) * 10 # => (780+580i)
720
+ * Complex(5.6, 3.4) * 10 # => (56+34i)
707
721
*/
708
722
static VALUE
709
723
nucomp_mul (VALUE self , VALUE other )
0 commit comments