Rename a math op to be accurate
diff --git a/include/num.h b/include/num.h
index 0a21193..96816ee 100644
--- a/include/num.h
+++ b/include/num.h
@@ -70,7 +70,7 @@
BcStatus bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale);
BcStatus bc_num_mul(BcNum *a, BcNum *b, BcNum *c, size_t scale);
BcStatus bc_num_div(BcNum *a, BcNum *b, BcNum *c, size_t scale);
-BcStatus bc_num_mod(BcNum *a, BcNum *b, BcNum *c, size_t scale);
+BcStatus bc_num_rem(BcNum *a, BcNum *b, BcNum *c, size_t scale);
BcStatus bc_num_pow(BcNum *a, BcNum *b, BcNum *c, size_t scale);
BcStatus bc_num_sqrt(BcNum *a, BcNum *res, size_t scale);
diff --git a/src/data.c b/src/data.c
index 41a5043..4300d35 100644
--- a/src/data.c
+++ b/src/data.c
@@ -294,7 +294,7 @@
const char bc_num_hex_digits[] = "0123456789ABCDEF";
const BcNumBinaryOp bc_program_ops[] = {
- bc_num_pow, bc_num_mul, bc_num_div, bc_num_mod, bc_num_add, bc_num_sub,
+ bc_num_pow, bc_num_mul, bc_num_div, bc_num_rem, bc_num_add, bc_num_sub,
};
const char bc_program_stdin_name[] = "<stdin>";
diff --git a/src/num.c b/src/num.c
index 8aa34d3..a1420a4 100644
--- a/src/num.c
+++ b/src/num.c
@@ -458,7 +458,7 @@
return s;
}
-BcStatus bc_num_alg_mod(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
+BcStatus bc_num_alg_rem(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
BcStatus s;
BcNum c1, c2;
@@ -838,7 +838,7 @@
if ((s = bc_num_sub(n, &intp, &fracp, 0))) goto err;
while (intp.len) {
- if ((s = bc_num_mod(&intp, base, &digit, 0))) goto err;
+ if ((s = bc_num_rem(&intp, base, &digit, 0))) goto err;
if ((s = bc_num_ulong(&digit, &dig))) goto err;
if ((s = bc_vec_push(&stack, &dig))) goto err;
if ((s = bc_num_div(&intp, base, &intp, 0))) goto err;
@@ -1044,9 +1044,9 @@
return bc_num_binary(a, b, c, scale, bc_num_alg_d, req);
}
-BcStatus bc_num_mod(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
+BcStatus bc_num_rem(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
size_t req = BC_NUM_MREQ(a, b, scale);
- return bc_num_binary(a, b, c, scale, bc_num_alg_mod, req);
+ return bc_num_binary(a, b, c, scale, bc_num_alg_rem, req);
}
BcStatus bc_num_pow(BcNum *a, BcNum *b, BcNum *c, size_t scale) {
@@ -1253,21 +1253,21 @@
two.num[0] = 2;
bc_num_one(d);
- if ((s = bc_num_mod(ptr_a, ptr_c, &base, scale))) goto err;
+ if ((s = bc_num_rem(ptr_a, ptr_c, &base, scale))) goto err;
if ((s = bc_num_copy(&exp, ptr_b))) goto err;
while (exp.len) {
- if ((s = bc_num_mod(&exp, &two, &temp, scale))) goto err;
+ if ((s = bc_num_rem(&exp, &two, &temp, scale))) goto err;
if (BC_NUM_ONE(&temp)) {
if ((s = bc_num_mul(d, &base, &temp, scale))) goto err;
- if ((s = bc_num_mod(&temp, ptr_c, d, scale))) goto err;
+ if ((s = bc_num_rem(&temp, ptr_c, d, scale))) goto err;
}
if ((s = bc_num_div(&exp, &two, &exp, scale))) goto err;
if ((s = bc_num_mul(&base, &base, &temp, scale))) goto err;
- if ((s = bc_num_mod(&temp, ptr_c, &base, scale))) goto err;
+ if ((s = bc_num_rem(&temp, ptr_c, &base, scale))) goto err;
}
err: