Bug #10086 » Remove_Float#power_from_mathn.patch
| lib/mathn.rb | ||
|---|---|---|
|
module_function :sqrt
|
||
|
module_function :rsqrt
|
||
|
end
|
||
|
##
|
||
|
# When mathn is required, Float is changed to handle Complex numbers.
|
||
|
class Float
|
||
|
alias power! **
|
||
|
##
|
||
|
# Exponentiate by +other+
|
||
|
def ** (other)
|
||
|
if self < 0 && other.round != other
|
||
|
Complex(self, 0.0) ** other
|
||
|
else
|
||
|
power!(other)
|
||
|
end
|
||
|
end
|
||
|
end
|
||