# File lib/facets/more/quaternion.rb, line 475 def ** other # q1^q2 = exp((log q1)*q2) if other.kind_of?(Quaternion); ((self.log)*other).exp elsif other.kind_of?(Complex); ((self.log)*other).exp elsif other.kind_of?(Integer); if other==0; return One; elsif other>0; x = self; q = x; n = other - 1 while n != 0 while (d, m = n.divmod(2); m == 0); x = x*x; n = d; end q *= x; n -= 1 end return q else return self.inverse**(-other) end elsif Quaternion::generic?(other); ((self.log)*other).exp else x, y = other.coerce(self); x ** y end; end