summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/rational.c b/rational.c
index e779505fd0..4bdc695dc1 100644
--- a/rational.c
+++ b/rational.c
@@ -1046,6 +1046,10 @@ nurat_expt(VALUE self, VALUE other)
if (RB_FLOAT_TYPE_P(den)) return DBL2NUM(NAN);
return num;
}
+ if (RB_FLOAT_TYPE_P(den)) { /* infinity due to overflow */
+ num = ZERO;
+ den = ONE;
+ }
return f_rational_new2(CLASS_OF(self), num, den);
}
}