[all-commits] [llvm/llvm-project] 5814b7: [libc][math] Implement log10 function correctly ro...

lntue via All-commits all-commits at lists.llvm.org
Sun Jan 8 14:42:32 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5814b7b27963229ea78b2092990d72158da748a3
      https://github.com/llvm/llvm-project/commit/5814b7b27963229ea78b2092990d72158da748a3
  Author: Tue Ly <lntue at google.com>
  Date:   2023-01-08 (Sun, 08 Jan 2023)

  Changed paths:
    M libc/config/darwin/arm/entrypoints.txt
    M libc/config/linux/aarch64/entrypoints.txt
    M libc/config/linux/x86_64/entrypoints.txt
    M libc/config/windows/entrypoints.txt
    M libc/docs/math.rst
    A libc/docs/math/log.rst
    M libc/spec/stdc.td
    M libc/src/__support/FPUtil/CMakeLists.txt
    A libc/src/__support/FPUtil/double_double.h
    M libc/src/__support/FPUtil/dyadic_float.h
    M libc/src/__support/number_pair.h
    M libc/src/math/CMakeLists.txt
    M libc/src/math/generic/CMakeLists.txt
    A libc/src/math/generic/log10.cpp
    A libc/src/math/log10.h
    M libc/test/src/math/CMakeLists.txt
    A libc/test/src/math/log10_test.cpp

  Log Message:
  -----------
  [libc][math] Implement log10 function correctly rounded for all rounding modes

Implement double precision log10 function correctly rounded for all
rounding modes.  This implementation currently needs FMA instructions for
correctness.

Use 2 passes:
Fast pass:
- 1 step range reduction with a lookup table of `2^7 = 128` elements to reduce the ranges to `[-2^-7, 2^-7]`.
- Use a degree-7 minimax polynomial generated by Sollya, evaluated using a mixed of double-double and double precisions.
- Apply Ziv's test for accuracy.
Accurate pass:
- Apply 5 more range reduction steps to reduce the ranges further to [-2^-27, 2^-27].
- Use a degree-4 minimax polynomial generated by Sollya, evaluated using 192-bit precisions.
- By the result of Lefevre (add quote), this is more than enough for correct rounding to all rounding modes.

In progress: Adding detail documentations about the algorithm.

Depend on: https://reviews.llvm.org/D136799

Reviewed By: zimmermann6

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




More information about the All-commits mailing list