[libc] fix strtofloatingpoint on rare edge case
authorMichael Jones <michaelrj@google.com>
Mon, 18 Jul 2022 18:32:04 +0000 (11:32 -0700)
committerMichael Jones <michaelrj@google.com>
Mon, 18 Jul 2022 21:23:33 +0000 (14:23 -0700)
commitbf7f01d857eda2ea0753e92149c2941c7ad84bbc
tree6e9d642d68c637ede2d4114a453ef21847e7dcea
parent1a1324a303f856bb6cfd0a2bca00736c2b5bc187
[libc] fix strtofloatingpoint on rare edge case

Currently, there are two string parsers that can be used in a call to
strtofloatingpoint. There is the main parser used by Clinger's fast path
and Eisel-Lemire, and the backup parser used by Simple Decimal
Conversion. There was a bug in the backup parser where if the number had
more than 800 digits (the size of the SDC buffer) before the decimal
point, it would just ignore the digits after the 800th and not count
them into the exponent. This patch fixes that issue and adds regression
tests.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D130032
libc/src/__support/high_precision_decimal.h
libc/test/src/stdlib/strtod_test.cpp