Skip to content

Commit 3b05fd6

Browse files
Use xsimd::sincos when possible in xsimd::pow for complex number
1 parent 67067ad commit 3b05fd6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/xsimd/arch/generic/xsimd_generic_math.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,8 @@ namespace xsimd
20262026
auto cond = (y == ze);
20272027
r = select(cond, r, r * exp(-y * arga));
20282028
theta = select(cond, theta, theta + y * log(absa));
2029-
return select(absa == ze, cplx_batch(ze), cplx_batch(r * cos(theta), r * sin(theta)));
2029+
auto sincosTheta = xsimd::sincos(theta);
2030+
return select(absa == ze, cplx_batch(ze), cplx_batch(r * sincosTheta.second, r * sincosTheta.first));
20302031
}
20312032

20322033
// reciprocal

0 commit comments

Comments
 (0)