Skip to content
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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Kind-BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions