Skip to content

[DOC] Added documentation for rational literal #885

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

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 3 additions & 2 deletions rational.c
Original file line number Diff line number Diff line change
Expand Up @@ -2465,13 +2465,14 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
* a/b (b>0). Where a is numerator and b is denominator. Integer a
* equals rational a/1 mathematically.
*
* In ruby, you can create rational object with Rational, to_r or
* rationalize method. The return values will be irreducible.
* In ruby, you can create rational object with Rational, to_r,
* rationalize method or suffixing r to a literal. The return values will be irreducible.
*
* Rational(1) #=> (1/1)
* Rational(2, 3) #=> (2/3)
* Rational(4, -6) #=> (-2/3)
* 3.to_r #=> (3/1)
* 2/3r #=> (2/3)
*
* You can also create rational object from floating-point numbers or
* strings.
Expand Down