aboutsummaryrefslogtreecommitdiffstats
path: root/rational.c
diff options
context:
space:
mode:
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/rational.c b/rational.c
index ebc6979a97..3917541c13 100644
--- a/rational.c
+++ b/rational.c
@@ -715,6 +715,7 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
return f_rational_new_no_reduce2(CLASS_OF(self), num, den);
}
+static VALUE nurat_to_f(VALUE self);
/*
* call-seq:
* rat + numeric -> numeric
@@ -740,7 +741,7 @@ rb_rational_plus(VALUE self, VALUE other)
}
}
else if (RB_TYPE_P(other, T_FLOAT)) {
- return f_add(f_to_f(self), other);
+ return DBL2NUM(RFLOAT_VALUE(nurat_to_f(self)) + RFLOAT_VALUE(other));
}
else if (RB_TYPE_P(other, T_RATIONAL)) {
{