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

Skip to content

[DOC] RDoc for Complex #9260

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 4 commits into from
Dec 19, 2023
Merged

[DOC] RDoc for Complex #9260

merged 4 commits into from
Dec 19, 2023

Conversation

BurdetteLamar
Copy link
Member

#numerator and #denominator.

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label Dec 15, 2023
complex.c Outdated
* Complex(Rational(n.real, d), Rational(n.imag, d))
* #=> ((1/2)+(2/3)*i)
* See denominator.
* Related: Complex.denominator.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean Complex#denominator?

Suggested change
* Related: Complex.denominator.
* Related: Complex#denominator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

complex.c Outdated
Comment on lines 1508 to 1521
* This result is computed thus:
*
* 1 2 3+4i <- numerator
* - + -i -> ----
* 2 3 6 <- denominator
* # Numerators and denominators for c.real and c.imag.
* c.real.numerator # => 2
* c.real.denominator # => 3
* c.imag.numerator # => 3
* c.imag.denominator # => 4
* # Real and imaginary parts for new Complex c.numerator.
* result_real = c.real.numerator * c.imag.denominator # => 8
* result_imag = c.imag.numerator * c.real.denominator # => 9
* # New Complex c.numerator (Q.E.D.).
* result = Complex(result_real, result_imag) # => (8+9i)
* c.numerator # => (8+9i)
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this example to be difficult to understand. Can we explain using words instead? I think the numerator is the Complex created from the numerators of the real and imaginary parts after converting them to the least common denominator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revised.

@peterzhu2118 peterzhu2118 merged commit f907a71 into ruby:master Dec 19, 2023
@nurse nurse mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0