aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/gdbclientutils.py
diff options
context:
space:
mode:
authorlntue <lntue@google.com>2025-10-21 13:33:09 -0400
committerGitHub <noreply@github.com>2025-10-21 13:33:09 -0400
commit513f9c50e74e55b7f8dedf65105bdc1083d4f83d (patch)
tree0eecbc7ef1a4e0ef56dc2364980df46290f6e11b /lldb/packages/Python/lldbsuite/test/gdbclientutils.py
parent4a1ea3e4a973b1b742ce578661017a3f3eb6acfe (diff)
downloadllvm-513f9c50e74e55b7f8dedf65105bdc1083d4f83d.zip
llvm-513f9c50e74e55b7f8dedf65105bdc1083d4f83d.tar.gz
llvm-513f9c50e74e55b7f8dedf65105bdc1083d4f83d.tar.bz2
[libc][math] Add float-only implementation for sinf / cosf. (#161680)
Based on the double precision's sin/cos fast path algorithm: Step 1: Perform range reduction `y = x mod pi/8` with target errors < 2^-54. This is because the worst case mod pi/8 for single precision is ~2^-31, so to have up to 1 ULP errors from the range reduction, the targeted errors should `be 2^(-31 - 23) = 2^-54`. Step 2: Polynomial approximation We use degree-5 and degree-4 polynomials to approximate sin and cos of the reduced angle respectively. Step 3: Combine the results using trig identities ```math \begin{align*} \sin(x) &= \sin(y) \cdot \cos(k \cdot \frac{\pi}{8}) + \cos(y) \cdot \sin(k \cdot \frac{\pi}{8}) \\ \cos(x) &= \cos(y) \cdot \cos(k \cdot \frac{\pi}{8}) - \sin(y) \cdot \sin(k \cdot \frac{\pi}{8}) \end{align*} ``` Overall errors: <= 3 ULPs for default rounding modes (tested exhaustively). Current limitation: large range reduction requires FMA instructions for binary32. This restriction will be removed in the followup PR. --------- Co-authored-by: Petr Hosek <phosek@google.com>
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/gdbclientutils.py')
0 files changed, 0 insertions, 0 deletions