ModulusL 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 ModulusL (value : BigInt, modulus : BigInt) : BigInt

Input

value : BigInt

The value of which residue is computed

modulus : BigInt

The modulus by which residues are take, must be positive

Output : BigInt

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.