diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-13 12:59:22 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-13 12:59:22 +0000 |
commit | e0d427e855e514c758ffc8f776539abe70ad12d4 (patch) | |
tree | 7b1a2a4c34a1ba166038b7f921bdc535d9b40ddf /rational.c | |
parent | c7f4ebc8b703bc5d674752299e8190f424e92189 (diff) | |
download | bundler-e0d427e855e514c758ffc8f776539abe70ad12d4.tar.gz |
* rational.c (nurat_equal_p): Rational(0,x) and 0 are equivalent,
anyway.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r-- | rational.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/rational.c b/rational.c index d24195ac14..c81b89a4a7 100644 --- a/rational.c +++ b/rational.c @@ -865,6 +865,9 @@ nurat_equal_p(VALUE self, VALUE other) { get_dat1(self); + if (f_zero_p(dat->num) && f_zero_p(other)) + return Qtrue; + if (!FIXNUM_P(dat->den)) return Qfalse; if (FIX2LONG(dat->den) != 1) @@ -879,6 +882,9 @@ nurat_equal_p(VALUE self, VALUE other) { get_dat2(self, other); + if (f_zero_p(adat->num) && f_zero_p(bdat->num)) + return Qtrue; + return f_boolcast(f_equal_p(adat->num, bdat->num) && f_equal_p(adat->den, bdat->den)); } |