[libc-commits] [PATCH] D150399: [libc] add options to printf decimal floats

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 11 14:18:59 PDT 2023


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

This patch adds three options for printf decimal long doubles, and these
can also apply to doubles.

1. Use a giant table which is fast and accurate, but takes up ~5MB).
2. Use dyadic floats for approximations, which only gives ~50 digits of accuracy but is very fast.
3. Use large integers for approximations, which is accurate but very slow.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150399

Files:
  libc/src/__support/FPUtil/dyadic_float.h
  libc/src/__support/float_to_string.h
  libc/src/__support/ryu_constants.h
  libc/src/__support/ryu_long_double_constants.h
  libc/src/stdio/printf_core/converter.cpp
  libc/src/stdio/printf_core/printf_config.h
  libc/test/src/__support/high_precision_decimal_test.cpp
  libc/test/src/stdio/sprintf_test.cpp
  libc/utils/mathtools/ryu_tablegen.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150399.521446.patch
Type: text/x-patch
Size: 45549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230511/86794987/attachment-0001.bin>


More information about the libc-commits mailing list