File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
dpctl/tensor/libtensor/include/kernels/elementwise_functions Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -85,19 +85,19 @@ template <typename argT, typename resT> struct Expm1Functor
85
85
return in;
86
86
}
87
87
else {
88
- return (std::numeric_limits<realT>::infinity () *
89
- resT{std::cos (y), std::sin (y)} -
90
- realT (1 ));
88
+ return (x * resT{std::cos (y), std::sin (y)});
91
89
}
92
90
}
93
91
else {
94
92
// negative infinity cases
95
93
if (!std::isfinite (y)) {
96
- return resT{-1 , 0 };
94
+ // copy sign of y to guarantee
95
+ // conj(expm1(x)) == expm1(conj(x))
96
+ return resT{realT (-1 ), std::copysign (realT (0 ), y)};
97
97
}
98
98
else {
99
- return ( realT ( 0 ) * resT{std::cos (y), std::sin (y)} -
100
- realT (1 )) ;
99
+ return resT{realT (- 1 ),
100
+ std::copysign ( realT (0 ), std::sin (y))} ;
101
101
}
102
102
}
103
103
}
You can’t perform that action at this time.
0 commit comments