Closed mattwala closed 4 years ago
Similar to loopy, the cause is implementing subtraction as x + (-1) * y
.
I see three ways out of this:
pyopencl.elementwise
: x - y
(result_dtype)x + (-1)*(result_dtype)y
(result_dtype)x - (result_dtype)y
. It's not clear whether this is equivalent to the one above.The second/third options would be more intrusive changes but would be similar to what NumPy does.
IIUC, (result_dtype)x + (-1)*(result_dtype)y
succeeds because it produces a two's-complement (-1)
of the correct bit width. Correct?
IIUC,
(result_dtype)x + (-1)*(result_dtype)y
succeeds because it produces a two's-complement(-1)
of the correct bit width. Correct?
I haven’t tested it, but I think that’s how it should work.