summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2023-12-08 14:02:14 -0600
committerPeter Zhu <peter@peterzhu.ca>2023-12-08 15:13:11 -0500
commit9e7ca2c3c9d2fbdcdf7f3b6c0b8c63b2dbb08ebe (patch)
tree81f08c17fae8ece005117975d5bc900871c7869c /complex.c
parent98e3552cfb80d4d3a8176d9969ea4956adee93d5 (diff)
RDoc for Complex
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/complex.c b/complex.c
index de26192343..a1fde8bf19 100644
--- a/complex.c
+++ b/complex.c
@@ -474,12 +474,19 @@ nucomp_s_canonicalize_internal(VALUE klass, VALUE real, VALUE imag)
/*
* call-seq:
- * Complex.rect(real[, imag]) -> complex
- * Complex.rectangular(real[, imag]) -> complex
+ * Complex.rect(real, imag = 0) -> complex
*
- * Returns a complex object which denotes the given rectangular form.
+ * Returns a new \Complex object formed from the arguments,
+ * each of which must be an instance of Numeric,
+ * or an instance of one of its subclasses:
+ * \Complex, Float, Integer, Rational;
+ * see {Rectangular Coordinates}[rdoc-ref:Complex@Rectangular+Coordinates]:
+ *
+ * Complex.rect(3) # => (3+0i)
+ * Complex.rect(3, Math::PI) # => (3+3.141592653589793i)
+ * Complex.rect(-3, -Math::PI) # => (-3-3.141592653589793i)
*
- * Complex.rectangular(1, 2) #=> (1+2i)
+ * \Complex.rectangular is an alias for \Complex.rect.
*/
static VALUE
nucomp_s_new(int argc, VALUE *argv, VALUE klass)
@@ -698,14 +705,18 @@ rb_dbl_complex_new_polar_pi(double abs, double ang)
/*
* call-seq:
- * Complex.polar(abs[, arg]) -> complex
+ * Complex.polar(abs, arg = 0) -> complex
+ *
+ * Returns a new \Complex object formed from the arguments,
+ * each of which must be an instance of Numeric,
+ * or an instance of one of its subclasses:
+ * \Complex, Float, Integer, Rational;
+ * see {Polar Coordinates}[rdoc-ref:Complex@Polar+Coordinates]:
*
- * Returns a complex object which denotes the given polar form.
+ * Complex.polar(3) # => (3+0i)
+ * Complex.polar(3, 2.0) # => (-1.2484405096414273+2.727892280477045i)
+ * Complex.polar(-3, -2.0) # => (1.2484405096414273+2.727892280477045i)
*
- * Complex.polar(3, 0) #=> (3.0+0.0i)
- * Complex.polar(3, Math::PI/2) #=> (1.836909530733566e-16+3.0i)
- * Complex.polar(3, Math::PI) #=> (-3.0+3.673819061467132e-16i)
- * Complex.polar(3, -Math::PI/2) #=> (1.836909530733566e-16-3.0i)
*/
static VALUE
nucomp_s_polar(int argc, VALUE *argv, VALUE klass)