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 86c33b5..6cd31e1 100644
--- a/rational.c
+++ b/rational.c
@@ -1285,6 +1285,10 @@ f_round_common(int argc, VALUE *argv, VALUE self, VALUE (*func)(VALUE))
return self;
}
+ if (!k_rational_p(s)) {
+ s = f_rational_new_bang1(CLASS_OF(self), s);
+ }
+
s = (*func)(s);
s = f_div(f_rational_new_bang1(CLASS_OF(self), s), b);