Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

An issue about the IncrementByModularInteger function #681

Open
xwqmary opened this issue Aug 7, 2023 · 0 comments
Open

An issue about the IncrementByModularInteger function #681

xwqmary opened this issue Aug 7, 2023 · 0 comments
Labels
Kind-Bug Something isn't working

Comments

@xwqmary
Copy link

xwqmary commented Aug 7, 2023

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

@xwqmary xwqmary added the Kind-Bug Something isn't working label Aug 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Kind-Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant