jax.lax.rem#

jax.lax.rem(x, y)[source]#

Elementwise remainder: \(x \bmod y\).

This function lowers directly to the stablehlo.remainder operation. The sign of the result is taken from the dividend, and the absolute value of the result is always less than the divisor’s absolute value.

Integer division overflow (remainder by zero or remainder of INT_SMIN with -1) produces an implementation defined value.

Parameters:
  • x (ArrayLike) – Input arrays. Must have matching int or float dtypes. If neither is a scalar, x and y must have the same number of dimensions and be broadcast compatible.

  • y (ArrayLike) – Input arrays. Must have matching int or float dtypes. If neither is a scalar, x and y must have the same number of dimensions and be broadcast compatible.

Returns:

An array of the same dtype as x and y containing the remainder.

Return type:

Array

See also