Fix hang/incorrect result for ndigits(n,b) when b < 0

This presently hangs for n large enough to trigger the slow division code path in `ndigits0z`, since we have n::unsigned and we try to put a negative number in there, which turns into a huge unsigned number.

For smaller n, the result is wrong in most cases when b < 0.

This PR doesn't optimize the negative base version the same way the positive base version is optimized, but it at least doesn't hang and works for the cases I've tried.