[all-commits] [llvm/llvm-project] 688b97: [libc] add options to printf decimal floats

michaelrj-google via All-commits all-commits at lists.llvm.org
Thu Jun 8 14:23:29 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 688b9730d144ecc5bae5bdea7a6482df58abb75f
      https://github.com/llvm/llvm-project/commit/688b9730d144ecc5bae5bdea7a6482df58abb75f
  Author: Michael Jones <michaelrj at google.com>
  Date:   2023-06-08 (Thu, 08 Jun 2023)

  Changed paths:
    M libc/src/__support/CMakeLists.txt
    M libc/src/__support/FPUtil/dyadic_float.h
    M libc/src/__support/float_to_string.h
    M libc/src/__support/ryu_constants.h
    A libc/src/__support/ryu_long_double_constants.h
    M libc/src/stdio/printf_core/CMakeLists.txt
    M libc/src/stdio/printf_core/converter.cpp
    M libc/src/stdio/printf_core/printf_config.h
    M libc/test/src/stdio/sprintf_test.cpp
    A libc/utils/mathtools/ryu_tablegen.py
    M utils/bazel/llvm-project-overlay/libc/BUILD.bazel

  Log Message:
  -----------
  [libc] add options to printf decimal floats

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.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D150399




More information about the All-commits mailing list