ModulusI function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Math

Package: Microsoft.Quantum.Standard

Computes the canonical residue of value modulo modulus.

function ModulusI (value : Int, modulus : Int) : Int

Input

value : Int

The value of which residue is computed

modulus : Int

The modulus by which residues are take, must be positive

Output : Int

Integer $r$ between 0 and modulus - 1 such that value - r is divisible by modulus

Remarks

This function behaves different to how the operator % behaves in C# and Q# as in the result is always a non-negative integer between 0 and modulus - 1, even if value is negative.