mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 17:14:01 +02:00
* lib/rational.rb (Rational#to_i): fix rdoc. Rational(-7,4).to_i
should be -1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e81e55093
commit
17744b19fc
2 changed files with 7 additions and 2 deletions
|
@ -344,12 +344,12 @@ class Rational < Numeric
|
|||
# Converts the rational to an Integer. Not the _nearest_ integer, the
|
||||
# truncated integer. Study the following example carefully:
|
||||
# Rational(+7,4).to_i # -> 1
|
||||
# Rational(-7,4).to_i # -> -2
|
||||
# Rational(-7,4).to_i # -> -1
|
||||
# (-1.75).to_i # -> -1
|
||||
#
|
||||
# In other words:
|
||||
# Rational(-7,4) == -1.75 # -> true
|
||||
# Rational(-7,4).to_i == (-1.75).to_i # false
|
||||
# Rational(-7,4).to_i == (-1.75).to_i # -> true
|
||||
#
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue