1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/bigdecimal] Fix length calculation in rb_uint64_convert_to_BigDecimal

https://github.com/ruby/bigdecimal/commit/14e53ed7f6
This commit is contained in:
Kenta Murata 2021-01-12 16:54:36 +09:00
parent 1eb8eb55c2
commit ccabf4966f

View file

@ -2697,8 +2697,7 @@ rb_uint64_convert_to_BigDecimal(uint64_t uval, RB_UNUSED_VAR(size_t digs), int r
vp->frac[0] = (DECDIG)uval;
}
else {
const size_t len10 = ceil(LOG10_2 * bit_length(uval));
size_t len = roomof(len10, BASE_FIG);
const size_t len = (size_t)ceil(log10(uval) / BASE_FIG);
vp = VpAllocReal(len);
vp->MaxPrec = len;