Skip to content

Commit 65a75fb

Browse files
committed
Proper handling of large exponent values
1 parent c3bb14f commit 65a75fb

File tree

1 file changed

+9
-1
lines changed
  • dpnp/backend/kernels/elementwise_functions

1 file changed

+9
-1
lines changed

dpnp/backend/kernels/elementwise_functions/ldexp.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ struct LdexpFunctor
4141

4242
resT operator()(const argT1 &in1, const argT2 &in2) const
4343
{
44-
return sycl::ldexp(in1, in2);
44+
if (((int)in2) == in2) {
45+
return sycl::ldexp(in1, in2);
46+
}
47+
48+
// a separate handling for large integer values
49+
if (in2 > 0) {
50+
return std::numeric_limits<resT>::infinity();
51+
}
52+
return resT(0);
4553
}
4654
};
4755
} // namespace dpnp::kernels::ldexp

0 commit comments

Comments
 (0)