This is an archive of the discontinued LLVM Phabricator instance.

[libc] fix strtofloatingpoint on rare edge case
ClosedPublic

Authored by michaelrj on Jul 18 2022, 11:36 AM.

Details

Summary

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.

Diff Detail

Event Timeline

michaelrj created this revision.Jul 18 2022, 11:36 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 18 2022, 11:36 AM
michaelrj requested review of this revision.Jul 18 2022, 11:36 AM
lntue accepted this revision.Jul 18 2022, 11:46 AM
This revision is now accepted and ready to land.Jul 18 2022, 11:46 AM

fix another small bug (leading zeroes were being counted as digits despite not affecting the actual number) and remove the test case from the comparison test data.

lntue accepted this revision.Jul 18 2022, 12:49 PM
This revision was automatically updated to reflect the committed changes.