[DOC] RDoc for Complex (#9260)

This commit is contained in:
Burdette Lamar 2023-12-18 20:40:58 -06:00 committed by GitHub
parent 36b389c206
commit f907a7111c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1477,11 +1477,17 @@ nucomp_real_p_m(VALUE self)
/* /*
* call-seq: * call-seq:
* cmp.denominator -> integer * denominator -> integer
* *
* Returns the denominator (lcm of both denominator - real and imag). * Returns the denominator of +self+, which is
* the {least common multiple}[https://en.wikipedia.org/wiki/Least_common_multiple]
* of <tt>self.real.denominator</tt> and <tt>self.imag.denominator</tt>:
* *
* See numerator. * Complex.rect(Rational(1, 2), Rational(2, 3)).denominator # => 6
*
* Note that <tt>n.denominator</tt> of a non-rational numeric is +1+.
*
* Related: Complex#numerator.
*/ */
static VALUE static VALUE
nucomp_denominator(VALUE self) nucomp_denominator(VALUE self)
@ -1492,21 +1498,23 @@ nucomp_denominator(VALUE self)
/* /*
* call-seq: * call-seq:
* cmp.numerator -> numeric * numerator -> new_complex
* *
* Returns the numerator. * Returns the \Complex object created from the numerators
* of the real and imaginary parts of +self+,
* after converting each part to the
* {lowest common denominator}[https://en.wikipedia.org/wiki/Lowest_common_denominator]
* of the two:
* *
* 1 2 3+4i <- numerator * c = Complex(Rational(2, 3), Rational(3, 4)) # => ((2/3)+(3/4)*i)
* - + -i -> ---- * c.numerator # => (8+9i)
* 2 3 6 <- denominator
* *
* c = Complex('1/2+2/3i') #=> ((1/2)+(2/3)*i) * In this example, the lowest common denominator of the two parts is 12;
* n = c.numerator #=> (3+4i) * the two converted parts may be thought of as \Complex(8, 12) and \Complex(9, 12),
* d = c.denominator #=> 6 * whose numerators, respectively, are 8 and 9;
* n / d #=> ((1/2)+(2/3)*i) * so the returned value of <tt>c.numerator</tt> is <tt>Complex(8, 9)</tt>.
* Complex(Rational(n.real, d), Rational(n.imag, d)) *
* #=> ((1/2)+(2/3)*i) * Related: Complex#denominator.
* See denominator.
*/ */
static VALUE static VALUE
nucomp_numerator(VALUE self) nucomp_numerator(VALUE self)