pub fn abs_diff<F: PrimeField, const BITS: usize>(
cs: ConstraintSystemRef<F>,
a: &FpVar<F>,
b: &FpVar<F>,
) -> Result<FpVar<F>, SynthesisError>Expand description
Computes the absolute difference between two field elements a and b using slack variables
to ensure that the result is correct without directly comparing the two values.
a and b must be in the range [0, 1 << BITS). BITS must be strictly less than the floor
of log2 of the field’s modulus.