commit | f679ad8f3ee3a65315785e87a341ece20c023365 | [log] [tgz] |
---|---|---|
author | Gavin Howard <yzena.tech@gmail.com> | Mon Oct 29 12:26:30 2018 -0600 |
committer | Gavin Howard <yzena.tech@gmail.com> | Mon Oct 29 12:26:30 2018 -0600 |
tree | 25d62e00b0999b6799d9ac96f6d2c8f3143bb72f | |
parent | 8f754d9d8540a13803241c8cb586dbfef623cac3 [diff] [blame] |
Fix a bug in divmod
diff --git a/src/num.c b/src/num.c index d01a055..461d1fb 100644 --- a/src/num.c +++ b/src/num.c
@@ -1297,13 +1297,12 @@ if ((init = (c == a))) { memcpy(&num2, c, sizeof(BcNum)); ptr_a = &num2; + if ((s = bc_num_init(c, len))) return s; } - else ptr_a = a; - - if (init) s = bc_num_init(c, len); - else s = bc_num_expand(d, ptr_a->len); - - if (s) return s; + else { + ptr_a = a; + if ((s = bc_num_expand(c, len))) return s; + } s = bc_num_r(ptr_a, b, c, d, scale, ts);