Improve speed of `ndigits0z(::BigInt)` using logarithms (#8743).