commit | 8b25487eb9f53ea79aec759cc36d68eca19e472d | [log] [tgz] |
---|---|---|
author | Gavin Howard <yzena.tech@gmail.com> | Wed Mar 14 01:13:35 2018 -0600 |
committer | Gavin Howard <yzena.tech@gmail.com> | Tue Aug 28 17:11:01 2018 -0600 |
tree | 7608eebd1100c6119bb50cc478e221c7d9a09f9f | |
parent | 9b4d86c43b43ff1186b5ca5dc9d95c8efd9c51e2 [diff] |
Handle zero special case in mod This was causing a problem with printing numbers in different bases correctly.
diff --git a/src/bc/num.c b/src/bc/num.c index 75a0f19..afe585d 100644 --- a/src/bc/num.c +++ b/src/bc/num.c
@@ -606,6 +606,13 @@ BcNum c2; size_t len; + if (!b->len) return BC_STATUS_MATH_DIVIDE_BY_ZERO; + + if (!a->len) { + bc_num_zero(c); + return BC_STATUS_SUCCESS; + } + len = a->len + b->len + scale; status = bc_num_init(&c1, len);