Flowdock
to_i() public

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
  (-1.75).to_i                    # -> -1

In other words:

  Rational(-7,4) == -1.75                 # -> true
  Rational(-7,4).to_i == (-1.75).to_i     # false
Show source
Register or log in to add new notes.