summaryrefslogtreecommitdiff
path: root/libc/src/math/generic/sin.cpp
AgeCommit message (Collapse)Author
2025-04-08[libc][math] Fix signaling NaN handling for math functions. (#133347)wldfngrs
Add tests for signaling NaNs, and fix function behavior for handling signaling NaN input. Fixes https://github.com/llvm/llvm-project/issues/124812
2025-04-04[libc] Remove extra parenthesis in sin.cpp comments (#134477)jobhdez
2025-03-11[libc] Provide more fine-grained control of FMA instruction for ARM targets. ↵lntue
(#130700)
2024-10-26[libc][math] Add tests and fix some issues with FTZ/DAZ modes. (#113744)lntue
2024-10-10[libc][math] Improve performance of double precision trig functions. (#111793)lntue
- Improve the accuracy of fast pass' range reduction. - Provide tighter error estimations. - Reduce the table size when `LIBC_MATH_SMALL_TABLES` flag is set.
2024-08-09[libc] Moved range_reduction_double ifdef statement (#102659)RoseZhang03
Sin/cos/tan fuzzers were having issues with ONE_TWENTY_EIGHT_OVER_PI, so the LIBC_TARGET_CPU_HAS_FMA ifdef statement got moved from the sin/cos/tan .cpp files to the range_reduction_double_common.cpp file.
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2024-07-07[libc] fix aarch64 GCC build (#97932)Schrodinger ZHU Yifan
This PR fix several build errors on aarch64 targets when building with gcc: - uninitialized values leading to `Werrors` - undefined builtin functions - glibc header pollution
2024-06-25[libc][math] Implement double precision cos correctly rounded to all ↵lntue
rounding modes. (#96591) Sharing the same algorithm as double precision sin: https://github.com/llvm/llvm-project/pull/95736
2024-06-24[libc][math] Implement double precision sin correctly rounded to all ↵lntue
rounding modes. (#95736) - Algorithm: - Step 1 - Range reduction: for a double precision input `x`, return `k` and `u` such that - k is an integer - u = x - k * pi / 128, and |u| < pi/256 - Step 2 - Calculate `sin(u)` and `cos(u)` in double-double using Taylor polynomials with errors < 2^-70 with FMA or < 2^-66 w/o FMA. - Step 3 - Calculate `sin(x) = sin(k*pi/128) * cos(u) + cos(k*pi/128) * sin(u)` using look-up table for `sin(k*pi/128)` and `cos(k*pi/128)`. - Step 4 - Use Ziv's rounding test to decide if the result is correctly rounded. - Step 4' - If the Ziv's rounding test failed, redo step 1-3 using 128-bit precision. - Currently, without FMA instructions, the large range reduction only works correctly for the default rounding mode (FE_TONEAREST). - Provide `LIBC_MATH` flag so that users can set `LIBC_MATH = LIBC_MATH_SKIP_ACCURATE_PASS` to build the `sin` function without step 4 and 4'.