Use `div` (integer divition) instead of `/` for rational numbers.

parent 0c91da25
......@@ -94,9 +94,9 @@ class Rational < Numeric
def _simplify
a = numerator
b = denominator
a, b = b, a % b while !b.zero?
@numerator /= a
@denominator /= a
a, b = b, a % b until b.zero?
@numerator = @numerator.div(a)
@denominator = @denominator.div(a)
end
attr_reader :numerator, :denominator
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment