Skip to main content

remainder

Function remainder 

Source
pub fn remainder<B: Backend, T: Num>(
    x: impl ArrayLike<B, T>,
    y: impl ArrayLike<B, T>,
) -> Array<B, T>
Expand description

The remainder with the sign of y (Python’s %, jnp.remainder): x - floor(x / y) * y, computed as JAX does (rem, adding y where the signs differ; an integer y of zero is replaced by one).

§Examples

use ruxla_core::{I32, Native, jnp};

let r = jnp::remainder(I32::<Native>::new(-7), I32::new(3));
assert_eq!(r.to_vec(), [2]);