summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-06 11:13:48 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-08-06 11:13:48 (GMT)
commitcba4d057853fc9d2dfe536a391d191d40cd03180 (patch)
treef1f19c86a4202480b4233912c8c187771b72f06b /rational.c
parentedd4332a3803fa30b4624371c1cc37fe75d19ff4 (diff)
* rational.c (nurat_div): divided by infinity should be zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/rational.c b/rational.c
index d732f8d..085f914 100644
--- a/rational.c
+++ b/rational.c
@@ -874,14 +874,7 @@ nurat_div(VALUE self, VALUE other)
get_dat1(self);
if (isnan(x)) return DBL2NUM(NAN);
- if (isinf(x)) {
- if (RTEST(f_negative_p(dat->num)) == (x < 0)) {
- return DBL2NUM(INFINITY);
- }
- else {
- return DBL2NUM(-INFINITY);
- }
- }
+ if (isinf(x)) return INT2FIX(0);
if (x != 0.0 && modf(x, &den) == 0.0) {
return rb_rational_raw2(dat->num, f_mul(rb_dbl2big(den), dat->den));
}