Skip to content

Commit b47b37c

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Harmonize #* methods
1 parent 2289961 commit b47b37c

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

complex.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -913,15 +913,16 @@ comp_mul(VALUE areal, VALUE aimag, VALUE breal, VALUE bimag, VALUE *real, VALUE
913913

914914
/*
915915
* call-seq:
916-
* complex * numeric -> new_complex
916+
* self * other -> numeric
917917
*
918-
* Returns the product of +self+ and +numeric+:
918+
* Returns the numeric product of +self+ and +other+:
919919
*
920+
* Complex.rect(9, 8) * 4 # => (36+32i)
921+
* Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
920922
* Complex.rect(2, 3) * Complex.rect(2, 3) # => (-5+12i)
921923
* Complex.rect(900) * Complex.rect(1) # => (900+0i)
922924
* Complex.rect(-2, 9) * Complex.rect(-9, 2) # => (0-85i)
923-
* Complex.rect(9, 8) * 4 # => (36+32i)
924-
* Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
925+
* Complex.rect(9, 8) * Rational(2, 3) # => ((6/1)+(16/3)*i)
925926
*
926927
*/
927928
VALUE

numeric.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,13 +1195,14 @@ rb_float_minus(VALUE x, VALUE y)
11951195
* call-seq:
11961196
* self * other -> numeric
11971197
*
1198-
* Returns a new \Float which is the product of +self+ and +other+:
1198+
* Returns the numeric product of +self+ and +other+:
11991199
*
12001200
* f = 3.14
12011201
* f * 2 # => 6.28
12021202
* f * 2.0 # => 6.28
12031203
* f * Rational(1, 2) # => 1.57
12041204
* f * Complex(2, 0) # => (6.28+0.0i)
1205+
*
12051206
*/
12061207

12071208
VALUE
@@ -4098,16 +4099,17 @@ fix_mul(VALUE x, VALUE y)
40984099

40994100
/*
41004101
* call-seq:
4101-
* self * numeric -> numeric_result
4102+
* self * other -> numeric
41024103
*
4103-
* Performs multiplication:
4104+
* Returns the numeric product of +self+ and +other+:
41044105
*
41054106
* 4 * 2 # => 8
4106-
* 4 * -2 # => -8
41074107
* -4 * 2 # => -8
4108+
* 4 * -2 # => -8
41084109
* 4 * 2.0 # => 8.0
41094110
* 4 * Rational(1, 3) # => (4/3)
41104111
* 4 * Complex(2, 0) # => (8+0i)
4112+
*
41114113
*/
41124114

41134115
VALUE

rational.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,15 +853,17 @@ f_muldiv(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
853853

854854
/*
855855
* call-seq:
856-
* rat * numeric -> numeric
856+
* self * other -> numeric
857857
*
858-
* Performs multiplication.
858+
* Returns the numeric product of +self+ and +other+:
859+
*
860+
* Rational(9, 8) * 4 #=> (9/2)
861+
* Rational(20, 9) * 9.8 #=> 21.77777777777778
862+
* Rational(9, 8) * Complex(1, 2) # => ((9/8)+(9/4)*i)
863+
* Rational(2, 3) * Rational(2, 3) #=> (4/9)
864+
* Rational(900) * Rational(1) #=> (900/1)
865+
* Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
859866
*
860-
* Rational(2, 3) * Rational(2, 3) #=> (4/9)
861-
* Rational(900) * Rational(1) #=> (900/1)
862-
* Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
863-
* Rational(9, 8) * 4 #=> (9/2)
864-
* Rational(20, 9) * 9.8 #=> 21.77777777777778
865867
*/
866868
VALUE
867869
rb_rational_mul(VALUE self, VALUE other)

0 commit comments

Comments
 (0)