Class: Rational

Inherits:
Numeric
  • Object
show all
Defined in:
lib/rubysl/rational/rational.rb

Overview

:enddoc:

Instance Method Summary collapse

Instance Method Details

#div(other) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/rubysl/rational/rational.rb', line 4

def div(other)
  if other.is_a?(Float) && other == 0.0
    raise ZeroDivisionError, "division by zero"
  end

  (self / other).floor
end