[libc-commits] [PATCH] D157535: [libc] Fix printf %f bugs

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Aug 9 11:42:55 PDT 2023


michaelrj created this revision.
michaelrj added reviewers: sivachandra, lntue.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
michaelrj requested review of this revision.

Fuzzing revealed several bugs in the %f float conversion. This patch
fixes them. Most of these bugs are related to rounding, such as
1.999...999 being rounded to 2.999...999 instead of 2.000...000 due to
rounding up not properly changing the nines to zeros. Additionally, much
of the rounding infrastructure has been refactored out so it can be
shared with the other conversions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157535

Files:
  libc/src/stdio/printf_core/float_dec_converter.h
  libc/test/src/stdio/sprintf_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157535.548714.patch
Type: text/x-patch
Size: 10216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230809/4ef8d453/attachment.bin>


More information about the libc-commits mailing list