rational e$B$rFI$s$G$$$k>l9g!"0J2<$N$h$&$J%(%i!<$K$J$j$^$9!#e(B
$ ruby19 -r rational -r complex -e ‘1 ** Complex(1)’
/usr/local/ruby19/lib/ruby/1.9.0/rational.rb:520:in rpower': undefined method
>=’ for Complex(1, 0):Complex (NoMethodError)
from -e:1:in `’
e$B%j%j!<%9$5$l$?e(B 1.9.0 e$B$O>/$70c$$$^$9$,!"4pK\E*$KF1$8$G$9!#e(B
$ ruby190 -r rational -r complex -e ‘1 ** Complex(1)’
/usr/local/ruby190/lib/ruby/1.9.0/rational.rb:489:in >=': super: no superclass method
<=>’ for Complex(1, 0):Complex (NoMethodError)
from /usr/local/ruby190/lib/ruby/1.9.0/rational.rb:489:in
rpower' from -e:1:in
’
r9634 e$B$G!“e(B<=> e$B$,$J$/$J$j!”$D$$$3$N4Ve(B >=
e$B$J$I$b$J$/$J$C$?$3$H$,M}M3$G$9!#e(B
1.8 e$B$G$O!"$*$=$i$/8_49@-$X$NG[N8$+$ie(B <=>
e$B$,J|CV$5$l$F$$$k$?$a$G$7$g$&!#e(B
e$BLdBj$,$"$j$^$;$s!#e(B
e$B$H$j$"$($:!"e(Bcoerce e$B$9$k$h$&$K$7$F$_$^$7$?!#e(B
Index: lib/rational.rb
— lib/rational.rb (revision 15487)
+++ lib/rational.rb (working copy)
@@ -517,6 +517,10 @@
Returns a Rational number if the result is in fact rational (i.e.
+other+ < 0).
def rpower (other)
- if defined?(Complex) && Complex === other
-
x, y = other.coerce(self)
-
return x ** y
- end
if other >= 0
self.power!(other)
else
@@ -537,6 +541,10 @@
Returns a Rational number if the result is in fact rational (i.e.
+other+ < 0).
def rpower (other)
- if defined?(Complex) && Complex === other
-
x, y = other.coerce(self)
-
return x ** y
- end
if other >= 0
self.power!(other)
else