[DOC] Harmonize #* methods

This commit is contained in:
BurdetteLamar 2025-11-21 12:46:03 +00:00 committed by Peter Zhu
parent 2289961b48
commit b47b37c12c
Notes: git 2025-11-21 22:12:23 +00:00
3 changed files with 20 additions and 15 deletions

View File

@ -913,15 +913,16 @@ comp_mul(VALUE areal, VALUE aimag, VALUE breal, VALUE bimag, VALUE *real, VALUE
/*
* call-seq:
* complex * numeric -> new_complex
* self * other -> numeric
*
* Returns the product of +self+ and +numeric+:
* Returns the numeric product of +self+ and +other+:
*
* Complex.rect(9, 8) * 4 # => (36+32i)
* Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
* Complex.rect(2, 3) * Complex.rect(2, 3) # => (-5+12i)
* Complex.rect(900) * Complex.rect(1) # => (900+0i)
* Complex.rect(-2, 9) * Complex.rect(-9, 2) # => (0-85i)
* Complex.rect(9, 8) * 4 # => (36+32i)
* Complex.rect(20, 9) * 9.8 # => (196.0+88.2i)
* Complex.rect(9, 8) * Rational(2, 3) # => ((6/1)+(16/3)*i)
*
*/
VALUE

View File

@ -1195,13 +1195,14 @@ rb_float_minus(VALUE x, VALUE y)
* call-seq:
* self * other -> numeric
*
* Returns a new \Float which is the product of +self+ and +other+:
* Returns the numeric product of +self+ and +other+:
*
* f = 3.14
* f * 2 # => 6.28
* f * 2.0 # => 6.28
* f * Rational(1, 2) # => 1.57
* f * Complex(2, 0) # => (6.28+0.0i)
*
*/
VALUE
@ -4098,16 +4099,17 @@ fix_mul(VALUE x, VALUE y)
/*
* call-seq:
* self * numeric -> numeric_result
* self * other -> numeric
*
* Performs multiplication:
* Returns the numeric product of +self+ and +other+:
*
* 4 * 2 # => 8
* 4 * -2 # => -8
* -4 * 2 # => -8
* 4 * -2 # => -8
* 4 * 2.0 # => 8.0
* 4 * Rational(1, 3) # => (4/3)
* 4 * Complex(2, 0) # => (8+0i)
*
*/
VALUE

View File

@ -853,15 +853,17 @@ f_muldiv(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
/*
* call-seq:
* rat * numeric -> numeric
* self * other -> numeric
*
* Performs multiplication.
* Returns the numeric product of +self+ and +other+:
*
* Rational(9, 8) * 4 #=> (9/2)
* Rational(20, 9) * 9.8 #=> 21.77777777777778
* Rational(9, 8) * Complex(1, 2) # => ((9/8)+(9/4)*i)
* Rational(2, 3) * Rational(2, 3) #=> (4/9)
* Rational(900) * Rational(1) #=> (900/1)
* Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
*
* Rational(2, 3) * Rational(2, 3) #=> (4/9)
* Rational(900) * Rational(1) #=> (900/1)
* Rational(-2, 9) * Rational(-9, 2) #=> (1/1)
* Rational(9, 8) * 4 #=> (9/2)
* Rational(20, 9) * 9.8 #=> 21.77777777777778
*/
VALUE
rb_rational_mul(VALUE self, VALUE other)