diff --git a/complex.c b/complex.c index e5d4a1192a..aa905c1c88 100644 --- a/complex.c +++ b/complex.c @@ -845,12 +845,11 @@ f_divide(VALUE self, VALUE other, return f_complex_new2(CLASS_OF(self), x, y); } if (k_numeric_p(other) && f_real_p(other)) { + VALUE x, y; get_dat1(self); - return f_complex_new2(CLASS_OF(self), - rb_rational_canonicalize( - (*func)(dat->real, other)), - rb_rational_canonicalize( - (*func)(dat->imag, other))); + x = rb_rational_canonicalize((*func)(dat->real, other)); + y = rb_rational_canonicalize((*func)(dat->imag, other)); + return f_complex_new2(CLASS_OF(self), x, y); } return rb_num_coerce_bin(self, other, id); }