@@ -282,20 +282,26 @@ extern "C" {
282282void csqrtf_wrapper (const float [], float []);
283283void csqrt_wrapper (const double [], double []);
284284} // extern "C"
285+ #endif
285286
286287template <typename HostT>
287- static std::complex <HostT> CSQRT (const std::complex <HostT> &x) {
288+ static std::complex <HostT> CSqrt (const std::complex <HostT> &x) {
289+ std::complex <HostT> res;
290+ #if _AIX
288291 HostT y[2 ]{x.real (), x.imag ()};
289292 HostT r[2 ];
290293 if constexpr (std::is_same_v<HostT, float >) {
291294 csqrtf_wrapper (y, r);
292295 } else if constexpr (std::is_same_v<HostT, double >) {
293296 csqrt_wrapper (y, r);
294297 }
295- std::complex <HostT> res (r[0 ], r[1 ]);
298+ res.real (r[0 ]);
299+ res.imag (r[1 ]);
300+ #else
301+ res = std::sqrt (x);
302+ #endif
296303 return res;
297304}
298- #endif
299305
300306template <typename HostT>
301307struct HostRuntimeLibrary <std::complex <HostT>, LibraryVersion::Libm> {
@@ -322,11 +328,7 @@ struct HostRuntimeLibrary<std::complex<HostT>, LibraryVersion::Libm> {
322328 FolderFactory<F2B, F2B{StdPowF2B}>::Create (" pow" ),
323329 FolderFactory<F, F{std::sin}>::Create (" sin" ),
324330 FolderFactory<F, F{std::sinh}>::Create (" sinh" ),
325- #ifdef _AIX
326- FolderFactory<F, F{CSQRT}>::Create (" sqrt" ),
327- #else
328- FolderFactory<F, F{std::sqrt}>::Create (" sqrt" ),
329- #endif
331+ FolderFactory<F, F{CSqrt}>::Create (" sqrt" ),
330332 FolderFactory<F, F{std::tan}>::Create (" tan" ),
331333 FolderFactory<F, F{std::tanh}>::Create (" tanh" ),
332334 };
0 commit comments