Skip to content

Provide tan in libc #96930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
petrhosek opened this issue Jun 27, 2024 · 1 comment · Fixed by #97489
Closed

Provide tan in libc #96930

petrhosek opened this issue Jun 27, 2024 · 1 comment · Fixed by #97489
Assignees
Labels

Comments

@petrhosek
Copy link
Member

We're trying to build Pico SDK against LLVM libc and tan is one of the missing functions.

@llvmbot
Copy link
Member

llvmbot commented Jun 27, 2024

@llvm/issue-subscribers-libc

Author: Petr Hosek (petrhosek)

We're trying to build Pico SDK against LLVM libc and `tan` is one of the missing functions.

@lntue lntue closed this as completed in 7d68d9d Jul 3, 2024
kbluck pushed a commit to kbluck/llvm-project that referenced this issue Jul 6, 2024
…7489)

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 llvm#96930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants