[libcxx-commits] [libcxx] [libcxx] Improve accuracy of complex exp (PR #165254)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 27 07:01:25 PDT 2025
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 origin/main HEAD --extensions ,cpp -- libcxx/test/libcxx/numerics/complex.number/exp.pass.cpp libcxx/include/complex --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/libcxx/numerics/complex.number/exp.pass.cpp b/libcxx/test/libcxx/numerics/complex.number/exp.pass.cpp
index 74c4a1887..c4930458b 100644
--- a/libcxx/test/libcxx/numerics/complex.number/exp.pass.cpp
+++ b/libcxx/test/libcxx/numerics/complex.number/exp.pass.cpp
@@ -24,21 +24,21 @@
template <class T>
void test_overflow_case() {
- typedef std::complex<T> C;
+ typedef std::complex<T> C;
- // In this case, the overflow of exp(real_part) is compensated when
- // sin(imag_part) is close to zero, resulting in a finite imaginary part.
- C z(T(90.0238094), T(5.900613e-39));
- C result = std::exp(z);
+ // In this case, the overflow of exp(real_part) is compensated when
+ // sin(imag_part) is close to zero, resulting in a finite imaginary part.
+ C z(T(90.0238094), T(5.900613e-39));
+ C result = std::exp(z);
- assert(std::isinf(result.real()));
- assert(result.real() > 0);
+ assert(std::isinf(result.real()));
+ assert(result.real() > 0);
- assert(std::isfinite(result.imag()));
- assert(std::abs(result.imag() - T(7.3746)) < T(1.0));
+ assert(std::isfinite(result.imag()));
+ assert(std::abs(result.imag() - T(7.3746)) < T(1.0));
}
int main(int, char**) {
- test_overflow_case<float>();
- return 0;
+ test_overflow_case<float>();
+ return 0;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/165254
More information about the libcxx-commits
mailing list