Project

General

Profile

Bug #10086 » Remove_Bignum#power_from_mathn.patch

gogotanaka (Kazuki Tanaka), 07/23/2014 11:58 AM

View differences:

lib/mathn.rb
end
##
# When mathn is required Bignum's division and exponentiation are enhanced to
# When mathn is required Bignum's division is enhanced to
# return more precise values from mathematical expressions.
#
# (2**72) / ((2**70) * 3) # => 4/3
class Bignum
remove_method :/
##
# +/+ defines the Rational division for Bignum.
#
# (2**72) / ((2**70) * 3) # => 4/3
alias / quo
alias power! ** unless method_defined? :power!
##
# Exponentiate by +other+
def ** (other)
if self < 0 && other.round != other
Complex(self, 0.0) ** other
else
power!(other)
end
end
alias :/ :quo
end
##
(2-2/7)