@@ -1477,11 +1477,17 @@ nucomp_real_p_m(VALUE self)
1477
1477
1478
1478
/*
1479
1479
* call-seq:
1480
- * cmp. denominator -> integer
1480
+ * denominator -> integer
1481
1481
*
1482
- * Returns the denominator (lcm of both denominator - real and imag).
1482
+ * Returns the denominator of +self+, which is
1483
+ * the {least common multiple}[https://en.wikipedia.org/wiki/Least_common_multiple]
1484
+ * of <tt>self.real.denominator</tt> and <tt>self.imag.denominator</tt>:
1483
1485
*
1484
- * See numerator.
1486
+ * Complex.rect(Rational(1, 2), Rational(2, 3)).denominator # => 6
1487
+ *
1488
+ * Note that <tt>n.denominator</tt> of a non-rational numeric is +1+.
1489
+ *
1490
+ * Related: Complex#numerator.
1485
1491
*/
1486
1492
static VALUE
1487
1493
nucomp_denominator (VALUE self )
@@ -1492,21 +1498,23 @@ nucomp_denominator(VALUE self)
1492
1498
1493
1499
/*
1494
1500
* call-seq:
1495
- * cmp.numerator -> numeric
1501
+ * numerator -> new_complex
1502
+ *
1503
+ * Returns the \Complex object created from the numerators
1504
+ * of the real and imaginary parts of +self+,
1505
+ * after converting each part to the
1506
+ * {lowest common denominator}[https://en.wikipedia.org/wiki/Lowest_common_denominator]
1507
+ * of the two:
1496
1508
*
1497
- * Returns the numerator.
1509
+ * c = Complex(Rational(2, 3), Rational(3, 4)) # => ((2/3)+(3/4)*i)
1510
+ * c.numerator # => (8+9i)
1498
1511
*
1499
- * 1 2 3+4i <- numerator
1500
- * - + -i -> ----
1501
- * 2 3 6 <- denominator
1512
+ * In this example, the lowest common denominator of the two parts is 12;
1513
+ * the two converted parts may be thought of as \Complex(8, 12) and \Complex(9, 12),
1514
+ * whose numerators, respectively, are 8 and 9;
1515
+ * so the returned value of <tt>c.numerator</tt> is <tt>Complex(8, 9)</tt>.
1502
1516
*
1503
- * c = Complex('1/2+2/3i') #=> ((1/2)+(2/3)*i)
1504
- * n = c.numerator #=> (3+4i)
1505
- * d = c.denominator #=> 6
1506
- * n / d #=> ((1/2)+(2/3)*i)
1507
- * Complex(Rational(n.real, d), Rational(n.imag, d))
1508
- * #=> ((1/2)+(2/3)*i)
1509
- * See denominator.
1517
+ * Related: Complex#denominator.
1510
1518
*/
1511
1519
static VALUE
1512
1520
nucomp_numerator (VALUE self )
0 commit comments