diff options
-rw-r--r-- | miscutils/bc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index c36486414..ca9506929 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -2246,8 +2246,14 @@ static void bc_num_parseDecimal(BcNum *n, const char *val) | |||
2246 | n->rdx = (size_t)((val + len) - (ptr + 1)); | 2246 | n->rdx = (size_t)((val + len) - (ptr + 1)); |
2247 | 2247 | ||
2248 | if (!zero) { | 2248 | if (!zero) { |
2249 | for (i = len - 1; i < len; ++n->len, i -= 1 + (i && val[i - 1] == '.')) | 2249 | i = len - 1; |
2250 | for (;;) { | ||
2250 | n->num[n->len] = val[i] - '0'; | 2251 | n->num[n->len] = val[i] - '0'; |
2252 | ++n->len; | ||
2253 | skip_dot: | ||
2254 | if ((ssize_t)--i == (ssize_t)-1) break; | ||
2255 | if (val[i] == '.') goto skip_dot; | ||
2256 | } | ||
2251 | } | 2257 | } |
2252 | } | 2258 | } |
2253 | 2259 | ||