* lib/mathn.rb ({Fixnum,Bignum,Float}#**): may produce complex
value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bde8a01d0a
commit
0b99ce1fd6
@ -1,3 +1,8 @@
|
|||||||
|
Sun Sep 28 09:39:48 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* lib/mathn.rb ({Fixnum,Bignum,Float}#**): may produce complex
|
||||||
|
value.
|
||||||
|
|
||||||
Sun Sep 28 09:05:53 2008 James Edward Gray II <jeg2@ruby-lang.org>
|
Sun Sep 28 09:05:53 2008 James Edward Gray II <jeg2@ruby-lang.org>
|
||||||
|
|
||||||
* lib/csv/csv.rb: Worked around some minor encoding changes in Ruby
|
* lib/csv/csv.rb: Worked around some minor encoding changes in Ruby
|
||||||
|
30
lib/mathn.rb
30
lib/mathn.rb
@ -61,6 +61,16 @@ class Fixnum
|
|||||||
remove_method :/
|
remove_method :/
|
||||||
alias / quo
|
alias / quo
|
||||||
|
|
||||||
|
alias power! **
|
||||||
|
|
||||||
|
def ** (other)
|
||||||
|
if self < 0 && other.round != other
|
||||||
|
Complex(self, 0.0) ** other
|
||||||
|
else
|
||||||
|
power!(other)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def_canon *(instance_methods - Object.methods - [:canon])
|
def_canon *(instance_methods - Object.methods - [:canon])
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -69,6 +79,16 @@ class Bignum
|
|||||||
remove_method :/
|
remove_method :/
|
||||||
alias / quo
|
alias / quo
|
||||||
|
|
||||||
|
alias power! **
|
||||||
|
|
||||||
|
def ** (other)
|
||||||
|
if self < 0 && other.round != other
|
||||||
|
Complex(self, 0.0) ** other
|
||||||
|
else
|
||||||
|
power!(other)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def_canon *(instance_methods - Object.methods - [:canon])
|
def_canon *(instance_methods - Object.methods - [:canon])
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -261,4 +281,14 @@ class Float
|
|||||||
|
|
||||||
def_canon *(instance_methods - Object.methods - [:canon])
|
def_canon *(instance_methods - Object.methods - [:canon])
|
||||||
|
|
||||||
|
alias power! **
|
||||||
|
|
||||||
|
def ** (other)
|
||||||
|
if self < 0 && other.round != other
|
||||||
|
Complex(self, 0.0) ** other
|
||||||
|
else
|
||||||
|
power!(other)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user