[libcxx-commits] [libcxx] [libc++] Use libm implementations in exp for complex numbers (PR #165457)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 29 06:08:31 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/include/complex b/libcxx/include/complex
index 21518b0e5..b04ea46b1 100644
--- a/libcxx/include/complex
+++ b/libcxx/include/complex
@@ -1074,7 +1074,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> sqrt(const complex<_Tp>& __x) {
// exp
-#if _LIBCPP_HAS_C99_COMPLEX
+# if _LIBCPP_HAS_C99_COMPLEX
_LIBCPP_HIDE_FROM_ABI inline _Complex float __cexp(_Complex float __v) { return __builtin_cexpf(__v); }
_LIBCPP_HIDE_FROM_ABI inline _Complex double __cexp(_Complex double __v) { return __builtin_cexp(__v); }
_LIBCPP_HIDE_FROM_ABI inline _Complex long double __cexp(_Complex long double __v) { return __builtin_cexpl(__v); }
@@ -1083,7 +1083,7 @@ template <class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
return complex<_Tp>(__from_builtin_tag(), std::__cexp(__x.__builtin()));
}
-#else
+# else
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
_Tp __i = __x.imag();
@@ -1107,7 +1107,7 @@ _LIBCPP_HIDE_FROM_ABI complex<_Tp> exp(const complex<_Tp>& __x) {
_Tp __e = std::exp(__x.real());
return complex<_Tp>(__e * std::cos(__i), __e * std::sin(__i));
}
-#endif
+# endif
// pow
``````````
</details>
https://github.com/llvm/llvm-project/pull/165457
More information about the libcxx-commits
mailing list