10000 [DOC] RDoc for Complex by BurdetteLamar · Pull Request #9254 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

[DOC] RDoc for Complex #9254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 33 additions & 14 deletions complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,12 +1399,22 @@ rb_complex_arg(VALUE self)

/*
* call-seq:
* cmp.rect -> array
* cmp.rectangular -> array
* rect -> array
*
* Returns an array; [cmp.real, cmp.imag].
* Returns the array <tt>[self.real, self.imag]</tt>:
*
* Complex(1, 2).rectangular #=> [1, 2]
* Complex.rect(1, 2).rect # => [1, 2]
*
* See {Rectangular Coordinates}[rdoc-ref:Complex@Rectangular+Coordinates].
*
* If +self+ was created with
* {polar coordinates}[rdoc-ref:Complex@Polar+Coordinates], the returned value
* is computed, and may be inexact:
*
* Complex.polar(1.0, 1.0).rect # => [0.5403023058681398, 0.8414709848078965]
*
*
* Complex#rectangular is an alias for Complex#rect.
*/
static VALUE
nucomp_rect(VALUE self)
Expand All @@ -1415,11 +1425,20 @@ nucomp_rect(VALUE self)

/*
* call-seq:
* cmp.polar -> array
* polar -> array
*
* Returns an array; [cmp.abs, cmp.arg].
* Returns the array <tt>[self.abs, self.arg]</tt>:
*
* Complex.polar(1, 2).polar # => [1.0, 2.0]
*
* See {Polar Coordinates}[rdoc-ref:Complex@Polar+Coordinates].
*
* If +self+ was created with
* {rectangular coordinates}[rdoc-ref:Complex@Rectangular+Coordinates], the returned value
* is computed, and may be inexact:
*
* Complex.rect(1, 1).polar # => [1.4142135623730951, 0.7853981633974483]
*
* Complex(1, 2).polar #=> [2.23606797749979, 1.1071487177940904]
*/
static VALUE
nucomp_polar(VALUE self)
Expand All @@ -1429,12 +1448,13 @@ nucomp_polar(VALUE self)

/*
* call-seq:
* cmp.conj -> complex
* cmp.conjugate -> complex
* conj -> complex
*
* Returns the conjugate of +self+, <tt>Complex.rect(self.imag, self.real)</tt>:
*
* Returns the complex conjugate.
* Complex.rect(1, 2).conj # => (1-2i)
*
* Complex(1, 2).conjugate #=> (1-2i)
* Complex#conjugate is an alias for Complex#conj.
*/
VALUE
rb_complex_conjugate(VALUE self)
Expand All @@ -1445,10 +1465,9 @@ rb_complex_conjugate(VALUE self)

/*
* call-seq:
* Complex(1).real? -> false
* Complex(1, 2).real? -> false
* real? -> false
*
* Returns false, even if the complex number has no imaginary part.
* Returns +false+; for compatibility with Numeric#real?.
*/
static VALUE
nucomp_real_p_m(VALUE self)
Expand Down
0