aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/bc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 148e340a5..d208a0cc6 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -2031,8 +2031,9 @@ static void bc_num_parseDecimal(BcNum *n, const char *val)
2031 2031
2032 ptr = strchr(val, '.'); 2032 ptr = strchr(val, '.');
2033 2033
2034 // Explicitly test for NULL here to produce either a 0 or 1. 2034 n->rdx = 0;
2035 n->rdx = (size_t)((ptr != NULL) * ((val + len) - (ptr + 1))); 2035 if (ptr != NULL)
2036 n->rdx = (size_t)((val + len) - (ptr + 1));
2036 2037
2037 if (!zero) { 2038 if (!zero) {
2038 for (i = len - 1; i < len; ++n->len, i -= 1 + (i && val[i - 1] == '.')) 2039 for (i = len - 1; i < len; ++n->len, i -= 1 + (i && val[i - 1] == '.'))
@@ -2802,7 +2803,7 @@ static BcStatus bc_lex_number(BcLex *l, char start)
2802 c = buf[++i]; 2803 c = buf[++i];
2803 } 2804 }
2804 2805
2805 len = i + 1 * !last_pt - bslashes * 2; 2806 len = i + !last_pt - bslashes * 2;
2806 if (len > BC_MAX_NUM) 2807 if (len > BC_MAX_NUM)
2807 return bc_error("number too long: must be [1, BC_NUM_MAX]"); 2808 return bc_error("number too long: must be [1, BC_NUM_MAX]");
2808 2809