[all-commits] [llvm/llvm-project] da2859: [libc][math] Implement double precision expm1 func...

lntue via All-commits all-commits at lists.llvm.org
Thu Sep 28 13:43:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: da28593d71a8581bdcf6b99346e1cd625076aaff
      https://github.com/llvm/llvm-project/commit/da28593d71a8581bdcf6b99346e1cd625076aaff
  Author: lntue <35648136+lntue at users.noreply.github.com>
  Date:   2023-09-28 (Thu, 28 Sep 2023)

  Changed paths:
    M libc/config/darwin/arm/entrypoints.txt
    M libc/config/linux/aarch64/entrypoints.txt
    M libc/config/linux/riscv/entrypoints.txt
    M libc/config/linux/x86_64/entrypoints.txt
    M libc/config/windows/entrypoints.txt
    M libc/docs/math/index.rst
    M libc/spec/stdc.td
    M libc/src/__support/FPUtil/FPBits.h
    M libc/src/__support/FPUtil/except_value_utils.h
    M libc/src/math/CMakeLists.txt
    A libc/src/math/expm1.h
    M libc/src/math/generic/CMakeLists.txt
    M libc/src/math/generic/exp.cpp
    A libc/src/math/generic/expm1.cpp
    M libc/src/math/generic/expm1f.cpp
    M libc/src/math/generic/log1pf.cpp
    M libc/test/src/math/CMakeLists.txt
    A libc/test/src/math/expm1_test.cpp
    M libc/test/src/math/smoke/CMakeLists.txt
    A libc/test/src/math/smoke/expm1_test.cpp
    M utils/bazel/llvm-project-overlay/libc/BUILD.bazel

  Log Message:
  -----------
  [libc][math] Implement double precision expm1 function correctly rounded for all  rounding modes. (#67048)

Implementing expm1 function for double precision based on exp function
algorithm:

- Reduced x = log2(e) * (hi + mid1 + mid2) + lo, where:
  * hi is an integer
  * mid1 * 2^-6 is an integer
  * mid2 * 2^-12 is an integer
  * |lo| < 2^-13 + 2^-30
- Then exp(x) - 1 = 2^hi * 2^mid1 * 2^mid2 * exp(lo) - 1 ~ 2^hi *
(2^mid1 * 2^mid2 * (1 + lo * P(lo)) - 2^(-hi) )
- We evaluate fast pass with P(lo) is a degree-3 Taylor polynomial of
(e^lo - 1) / lo in double precision
- If the Ziv accuracy test fails, we use degree-6 Taylor polynomial of
(e^lo - 1) / lo in double double precision
- If the Ziv accuracy test still fails, we re-evaluate everything in
128-bit precision.




More information about the All-commits mailing list