Triton has a nice paragraph explaining differences from NumPy semantics. We should also have this, and check these examples.
Differences with NumPy¶
C rounding in integer division Operators in Triton follow C semantics rather than Python semantics for efficiency. As such, int // int implements rounding towards zero as in C for integers of mixed signs, rather than rounding towards minus infinity as in Python. For the same reason, the modulus operator int % int (which is defined as a % b = a - b * (a // b)) also follows C semantics rather than Python semantics.
Perhaps confusingly, integer division and modulus follow Python semantics for computations where all the inputs are scalars.
Triton has a nice paragraph explaining differences from NumPy semantics. We should also have this, and check these examples.