Skip to content

Commit b4f470d

Browse files
committed
Stop using GetVpValueWithPrec in rb_rational_convert_to_BigDecimal
1 parent 96c9ebd commit b4f470d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ext/bigdecimal/bigdecimal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,8 +2849,10 @@ rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception)
28492849
"can't omit precision for a %"PRIsVALUE".",
28502850
CLASS_OF(val));
28512851
}
2852-
Real *vp = GetVpValueWithPrec(val, digs, 1);
2853-
return check_exception(vp->obj);
2852+
2853+
VALUE num = rb_inum_convert_to_BigDecimal(rb_rational_num(val), 0, raise_exception);
2854+
VALUE d = BigDecimal_div2(num, rb_rational_den(val), SIZET2NUM(digs));
2855+
return d;
28542856
}
28552857

28562858
static VALUE

0 commit comments

Comments
 (0)