Skip to content

Commit 190e5d3

Browse files
committed
Complex log1p return value is properly initialized
1 parent 909d894 commit 190e5d3

File tree

1 file changed

+3
-3
lines changed
  • dpctl/tensor/libtensor/include/kernels/elementwise_functions

1 file changed

+3
-3
lines changed

dpctl/tensor/libtensor/include/kernels/elementwise_functions/log1p.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ template <typename argT, typename resT> struct Log1pFunctor
8282
// imaginary part of result
8383
const realT res_im = std::atan2(y, x + 1);
8484

85-
if (std::max(std::abs(x), std::abs(y)) < realT(.1)) {
85+
if (std::max(std::abs(x), std::abs(y)) < realT{.1}) {
8686
const realT v = x * (2 + x) + y * y;
87-
return {std::log1p(v) / 2, res_im};
87+
return resT{std::log1p(v) / 2, res_im};
8888
}
8989
else {
9090
// when not close to zero,
9191
// prevent overflow
9292
const realT m = std::hypot(x + 1, y);
93-
return {std::log(m), res_im};
93+
return resT{std::log(m), res_im};
9494
}
9595
}
9696
else {

0 commit comments

Comments
 (0)