diff --git a/NEWS b/NEWS index fbbc21aab..76019fe50 100644 --- a/NEWS +++ b/NEWS @@ -94,6 +94,9 @@ Bug fixes BGZF::errcode field after calling bgzf_close() as it may no longer be valid. (PR #2035, #2042) +* Speed up hts_parse_decimal() handling of oversized exponents + (PR #2045) + Documentation updates --------------------- diff --git a/hts.c b/hts.c index 571969cec..e8d9d91e6 100644 --- a/hts.c +++ b/hts.c @@ -3923,8 +3923,8 @@ long long hts_parse_decimal(const char *str, char **strend, int flags) } e -= decimals; - while (e > 0) n *= 10, e--; - while (e < 0) lost += n % 10, n /= 10, e++; + while (e > 0 && n) n *= 10, e--; + while (e < 0 && n) lost += n % 10, n /= 10, e++; if (lost > 0) { hts_log_warning("Discarding fractional part of %.*s", (int)(s - str), str);