summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authorBurdette Lamar <BurdetteLamar@Yahoo.com>2023-12-28 08:33:06 -0600
committerGitHub <noreply@github.com>2023-12-28 09:33:06 -0500
commit0990270c38e9f49ae2d18db050c51539bddab82c (patch)
treedd13c781f849dd59842e418813b668b479830cee /complex.c
parentd8702ddbfbe8cc7fc601a9a4d19842ef9c2b76c1 (diff)
[DOC] Add What's Here for Complex (#9366)
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/complex.c b/complex.c
index bd081d0476..943d9e4121 100644
--- a/complex.c
+++ b/complex.c
@@ -2506,6 +2506,80 @@ float_arg(VALUE self)
* - Separately, with methods Complex#real and Complex#imag.
* - Together, with method Complex#rect.
*
+ * == What's Here
+ *
+ * First, what's elsewhere:
+ *
+ * - \Class \Complex inherits (directly or indirectly)
+ * from classes {Numeric}[rdoc-ref:Numeric@What-27s+Here]
+ * and {Object}[rdoc-ref:Object@What-27s+Here].
+ * - Includes (indirectly) module {Comparable}[rdoc-ref:Comparable@What-27s+Here].
+ *
+ * Here, class \Complex has methods for:
+ *
+ * === Creating \Complex Objects
+ *
+ * - ::polar: Returns a new \Complex object based on given polar coordinates.
+ * - ::rect (and its alias ::rectangular):
+ * Returns a new \Complex object based on given rectangular coordinates.
+ *
+ * === Querying
+ *
+ * - #abs (and its alias #magnitude): Returns the absolute value for +self+.
+ * - #arg (and its aliases #angle and #phase):
+ * Returns the argument (angle) for +self+ in radians.
+ * - #denominator: Returns the denominator of +self+.
+ * - #finite?: Returns whether both +self.real+ and +self.image+ are finite.
+ * - #hash: Returns the integer hash value for +self+.
+ * - #imag (and its alias #imaginary): Returns the imaginary value for +self+.
+ * - #infinite?: Returns whether +self.real+ or +self.image+ is infinite.
+ * - #numerator: Returns the numerator of +self+.
+ * - #polar: Returns the array <tt>[self.abs, self.arg]</tt>.
+ * - #inspect: Returns a string representation of +self+.
+ * - #real: Returns the real value for +self+.
+ * - #real?: Returns +false+; for compatibility with Numeric#real?.
+ * - #rect (and its alias #rectangular):
+ * Returns the array <tt>[self.real, self.imag]</tt>.
+ *
+ * === Comparing
+ *
+ * - #<=>: Returns whether +self+ is less than, equal to, or greater than the given argument.
+ * - #==: Returns whether +self+ is equal to the given argument.
+ *
+ * === Converting
+ *
+ * - #rationalize: Returns a Rational object whose value is exactly
+ * or approximately equivalent to that of <tt>self.real</tt>.
+ * - #to_c: Returns +self+.
+ * - #to_d: Returns the value as a BigDecimal object.
+ * - #to_f: Returns the value of <tt>self.real</tt> as a Float, if possible.
+ * - #to_i: Returns the value of <tt>self.real</tt> as an Integer, if possible.
+ * - #to_r: Returns the value of <tt>self.real</tt> as a Rational, if possible.
+ * - #to_s: Returns a string representation of +self+.
+ *
+ * === Performing Complex Arithmetic
+ *
+ * - #*: Returns the product of +self+ and the given numeric.
+ * - #**: Returns +self+ raised to power of the given numeric.
+ * - #+: Returns the sum of +self+ and the given numeric.
+ * - #-: Returns the difference of +self+ and the given numeric.
+ * - #-@: Returns the negation of +self+.
+ * - #/: Returns the quotient of +self+ and the given numeric.
+ * - #abs2: Returns square of the absolute value (magnitude) for +self+.
+ * - #conj (and its alias #conjugate): Returns the conjugate of +self+.
+ * - #fdiv: Returns <tt>Complex.rect(self.real/numeric, self.imag/numeric)</tt>.
+ *
+ * === Working with JSON
+ *
+ * - ::json_create: Returns a new \Complex object,
+ * deserialized from the given serialized hash.
+ * - #as_json: Returns a serialized hash constructed from +self+.
+ * - #to_json: Returns a JSON string representing +self+.
+ *
+ * These methods are provided by the {JSON gem}[https://github.com/flori/json]. To make these methods available:
+ *
+ * require 'json/add/complex'
+ *
*/
void
Init_Complex(void)