Fix division triggering asserts
diff --git a/src/num.c b/src/num.c
index b885cc6..451f050 100644
--- a/src/num.c
+++ b/src/num.c
@@ -174,6 +174,7 @@
size_t i;
BcBigDig carry = 0;
+ assert(b <= BC_BASE_DIG);
assert(c->cap >= a->len + 1);
memset(c->num, 0, BC_NUM_SIZE(c->cap));
@@ -1018,6 +1019,7 @@
n1 = (BcBigDig) n[len];
dividend = n1 * BC_BASE_DIG + (BcBigDig) n[len - 1];
q = (dividend / divisor + 1);
+ q = q > BC_BASE_DIG ? BC_BASE_DIG : q;
dividend = ((BcBigDig) bc_num_log10((size_t) q));
pow = bc_num_pow10[dividend - 1];