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 0261c69..1cd4ecc 100644
--- a/rational.c
+++ b/rational.c
@@ -1927,6 +1927,10 @@ rb_gcdlcm(VALUE self, VALUE other)
VALUE
rb_rational_raw(VALUE x, VALUE y)
{
+ if (! RB_INTEGER_TYPE_P(x))
+ x = rb_to_int(x);
+ if (! RB_INTEGER_TYPE_P(y))
+ y = rb_to_int(y);
if (INT_NEGATIVE_P(y)) {
x = rb_int_uminus(x);
y = rb_int_uminus(y);