@@ -440,6 +440,10 @@ nucomp_s_canonicalize_internal(VALUE klass, VALUE real, VALUE imag)
440440 * Complex.rectangular(real[, imag]) -> complex
441441 *
442442 * 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)
443447 */
444448static VALUE
445449nucomp_s_new (int argc , VALUE * argv , VALUE klass )
@@ -679,7 +683,11 @@ f_addsub(VALUE self, VALUE other,
679683 * call-seq:
680684 * cmp + numeric -> complex
681685 *
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+ *
683691 */
684692static VALUE
685693nucomp_add (VALUE self , VALUE other )
@@ -691,7 +699,10 @@ nucomp_add(VALUE self, VALUE other)
691699 * call-seq:
692700 * cmp - numeric -> complex
693701 *
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)
695706 */
696707static VALUE
697708nucomp_sub (VALUE self , VALUE other )
@@ -703,7 +714,10 @@ nucomp_sub(VALUE self, VALUE other)
703714 * call-seq:
704715 * cmp * numeric -> complex
705716 *
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)
707721 */
708722static VALUE
709723nucomp_mul (VALUE self , VALUE other )
0 commit comments