[libc-commits] [libc] [libc][math] Improve performance of double precision trig functions. (PR #111793)
via libc-commits
libc-commits at lists.llvm.org
Wed Oct 9 22:18:38 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 562999a9f32779c7017235969ec62d99e51a7865 fee360a05dcce594afb9f997c9f2904e00f089cc --extensions h,cpp -- libc/src/__support/FPUtil/double_double.h libc/src/__support/macros/optimization.h libc/src/math/generic/cos.cpp libc/src/math/generic/range_reduction_double_common.h libc/src/math/generic/range_reduction_double_fma.h libc/src/math/generic/range_reduction_double_nofma.h libc/src/math/generic/sin.cpp libc/src/math/generic/sincos.cpp libc/src/math/generic/sincos_eval.h libc/src/math/generic/tan.cpp libc/test/src/math/cos_test.cpp libc/test/src/math/sin_test.cpp libc/test/src/math/tan_test.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/src/math/generic/sin.cpp b/libc/src/math/generic/sin.cpp
index 4cbcb35513..37615b05a4 100644
--- a/libc/src/math/generic/sin.cpp
+++ b/libc/src/math/generic/sin.cpp
@@ -52,7 +52,7 @@ LLVM_LIBC_FUNCTION(double, sin, (double x)) {
if (LIBC_UNLIKELY(x == 0.0))
return x;
- // For |x| < 2^-26, |sin(x) - x| < ulp(x)/2.
+ // For |x| < 2^-26, |sin(x) - x| < ulp(x)/2.
#ifdef LIBC_TARGET_CPU_HAS_FMA
return fputil::multiply_add(x, -0x1.0p-54, x);
#else
diff --git a/libc/src/math/generic/tan.cpp b/libc/src/math/generic/tan.cpp
index 8c19936068..e4ed6127be 100644
--- a/libc/src/math/generic/tan.cpp
+++ b/libc/src/math/generic/tan.cpp
@@ -140,7 +140,7 @@ LLVM_LIBC_FUNCTION(double, tan, (double x)) {
if (LIBC_UNLIKELY(x == 0.0))
return x;
- // For |x| < 2^-27, |tan(x) - x| < ulp(x)/2.
+ // For |x| < 2^-27, |tan(x) - x| < ulp(x)/2.
#ifdef LIBC_TARGET_CPU_HAS_FMA
return fputil::multiply_add(x, 0x1.0p-54, x);
#else
``````````
</details>
https://github.com/llvm/llvm-project/pull/111793
More information about the libc-commits
mailing list