# File lib/rational.rb, line 220 def ** (other) if other.kind_of?(Rational) Float(self) ** other elsif other.kind_of?(Integer) if other > 0 num = @numerator ** other den = @denominator ** other elsif other < 0 num = @denominator ** -other den = @numerator ** -other elsif other == 0 num = 1 den = 1 end Rational.new!(num, den) elsif other.kind_of?(Float) Float(self) ** other else x, y = other.coerce(self) x ** y end end