[all-commits] [llvm/llvm-project] 7d68d9: [libc][math] Implement correctly rounded double pr...

lntue via All-commits all-commits at lists.llvm.org
Wed Jul 3 15:05:46 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d68d9d2f27535e03934383220282e18edd0c1e8
      https://github.com/llvm/llvm-project/commit/7d68d9d2f27535e03934383220282e18edd0c1e8
  Author: lntue <35648136+lntue at users.noreply.github.com>
  Date:   2024-07-03 (Wed, 03 Jul 2024)

  Changed paths:
    M libc/config/darwin/arm/entrypoints.txt
    M libc/config/linux/aarch64/entrypoints.txt
    M libc/config/linux/arm/entrypoints.txt
    M libc/config/linux/riscv/entrypoints.txt
    M libc/docs/math/index.rst
    M libc/src/__support/FPUtil/double_double.h
    M libc/src/math/generic/CMakeLists.txt
    A libc/src/math/generic/tan.cpp
    R libc/src/math/x86_64/CMakeLists.txt
    R libc/src/math/x86_64/tan.cpp
    M libc/test/src/math/smoke/CMakeLists.txt
    A libc/test/src/math/smoke/tan_test.cpp
    M libc/test/src/math/tan_test.cpp

  Log Message:
  -----------
  [libc][math] Implement correctly rounded double precision tan (#97489)

Using the same range reduction as `sin`, `cos`, and `sincos`:
1) Reducing `x = k*pi/128 + u`, with `|u| <= pi/256`, and `u` is in
double-double.
2) Approximate `tan(u)` using degree-9 Taylor polynomial.
3) Compute
```
   tan(x) ~ (sin(k*pi/128) + tan(u) * cos(k*pi/128)) / (cos(k*pi/128) - tan(u) * sin(k*pi/128))
```
using the fast double-double division algorithm in [the CORE-MATH
project](https://gitlab.inria.fr/core-math/core-math/-/blob/master/src/binary64/tan/tan.c#L1855).
4) Perform relative-error Ziv's accuracy test
5) If the accuracy tests failed, we redo the computations using 128-bit
precision `DyadicFloat`.

Fixes https://github.com/llvm/llvm-project/issues/96930



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list