ruby-changes:6035
From: matz <ko1@a...>
Date: Mon, 23 Jun 2008 12:36:40 +0900 (JST)
Subject: [ruby-changes:6035] Ruby:r17545 (trunk): * lib/mathn.rb (Rational::power2): removed incomplete method.
matz 2008-06-23 12:36:25 +0900 (Mon, 23 Jun 2008)
New Revision: 17545
Modified files:
trunk/ChangeLog
trunk/lib/mathn.rb
Log:
* lib/mathn.rb (Rational::power2): removed incomplete method.
see [ruby-dev:35195]. [ruby-core:17293]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17545&r2=17544&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/mathn.rb?r1=17545&r2=17544&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 17544)
+++ ChangeLog (revision 17545)
@@ -1,3 +1,8 @@
+Mon Jun 23 11:31:41 2008 Yukihiro Matsumoto <matz@r...>
+
+ * lib/mathn.rb (Rational::power2): removed incomplete method.
+ see [ruby-dev:35195]. [ruby-core:17293]
+
Sun Jun 22 14:16:28 2008 Nobuyoshi Nakada <nobu@r...>
* ext/readline/extconf.rb (have_readline_func): readline on Mac OS X
Index: lib/mathn.rb
===================================================================
--- lib/mathn.rb (revision 17544)
+++ lib/mathn.rb (revision 17545)
@@ -183,50 +183,6 @@
x ** y
end
end
-
- def power2(other)
- if other.kind_of?(Rational)
- if self < 0
- return Complex.__send__(:new!, self, 0) ** other
- elsif other == 0
- return Rational(1,1)
- elsif self == 0
- return Rational(0,1)
- elsif self == 1
- return Rational(1,1)
- end
-
- dem = nil
- x = self.denominator.to_f.to_i
- neard = self.denominator.to_f ** (1.0/other.denominator.to_f)
- loop do
- if (neard**other.denominator == self.denominator)
- dem = neard
- break
- end
- end
- nearn = self.numerator.to_f ** (1.0/other.denominator.to_f)
- Rational(num,den)
-
- elsif other.kind_of?(Integer)
- if other > 0
- num = numerator ** other
- den = denominator ** other
- elsif other < 0
- num = denominator ** -other
- den = numerator ** -other
- elsif other == 0
- num = 1
- den = 1
- end
- Rational(num, den)
- elsif other.kind_of?(Float)
- Float(self) ** other
- else
- x , y = other.coerce(self)
- x ** y
- end
- end
end
module Math
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/