This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
An issue about the IncrementByModularInteger function #681
Open
Description
Describe the bug
The function executes as if it were (increment+target) -modulus, not the (increment+target) %modulus in the description document
Testcase
namespace NISLNameSpace {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Arithmetic;
open Microsoft.Quantum.Diagnostics;
@EntryPoint()
operation main() : Unit {
mutable increment = 22;
mutable modulus = 5;
use NISLQubitArray38 = Qubit[7];
mutable target = LittleEndian(NISLQubitArray38);
let measuredResult1 = MeasureInteger(LittleEndian(target!));
IncrementByModularInteger(increment, modulus, target);
let measuredResult = MeasureInteger(LittleEndian(target!));
Message($"Measured result: {measuredResult}");
ResetAll(NISLQubitArray38);}
}
Expected behavior
Execute the command dotnet run -s QuantumSimulator to expect output 2 but the actual output is 17
**
System information
**
Operating system: Win 11
dotnet version 7.0.306