mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/mathn.rb (Fixnum): remove debug print.
* lib/rational.rb (Rational): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7559d2fd7a
commit
4e07664e19
3 changed files with 6 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Sep 20 01:01:41 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/mathn.rb (Fixnum): remove debug print.
|
||||||
|
|
||||||
|
* lib/rational.rb (Rational): ditto.
|
||||||
|
|
||||||
Tue Sep 20 00:34:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Tue Sep 20 00:34:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (io_close): call rb_io_close() directly if io is a T_FILE
|
* io.c (io_close): call rb_io_close() directly if io is a T_FILE
|
||||||
|
|
|
@ -118,9 +118,6 @@ end
|
||||||
class Fixnum
|
class Fixnum
|
||||||
remove_method :/
|
remove_method :/
|
||||||
alias / quo
|
alias / quo
|
||||||
alias_method :/, :quo
|
|
||||||
p :fixdiv
|
|
||||||
p [[:fixdiv, 1.div(1)]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class Bignum
|
class Bignum
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
def Rational(a, b = 1)
|
def Rational(a, b = 1)
|
||||||
p [:Rational, a, b]
|
|
||||||
if a.kind_of?(Rational) && b == 1
|
if a.kind_of?(Rational) && b == 1
|
||||||
a
|
a
|
||||||
else
|
else
|
||||||
|
@ -55,13 +54,9 @@ class Rational < Numeric
|
||||||
num = -num
|
num = -num
|
||||||
den = -den
|
den = -den
|
||||||
end
|
end
|
||||||
p [:reduce, num, den]
|
|
||||||
gcd = num.gcd(den)
|
gcd = num.gcd(den)
|
||||||
p [:div1, num, num.class, gcd]
|
|
||||||
num = num.div(gcd)
|
num = num.div(gcd)
|
||||||
p [:div2, den, gcd]
|
|
||||||
den = den.div(gcd)
|
den = den.div(gcd)
|
||||||
p [:gcd=, gcd]
|
|
||||||
if den == 1 && defined?(Unify)
|
if den == 1 && defined?(Unify)
|
||||||
num
|
num
|
||||||
else
|
else
|
||||||
|
@ -338,7 +333,6 @@ end
|
||||||
class Fixnum
|
class Fixnum
|
||||||
undef quo
|
undef quo
|
||||||
def quo(other)
|
def quo(other)
|
||||||
p [:quo, self, other]
|
|
||||||
Rational.new!(self,1) / other
|
Rational.new!(self,1) / other
|
||||||
end
|
end
|
||||||
alias rdiv quo
|
alias rdiv quo
|
||||||
|
|
Loading…
Reference in a new issue