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.

MeasureFxP fails to return smallest representable number #560

@msoeken

Description

@msoeken

Describe the bug
When measuring a quantum register in a state that corresponds to the smallest representable fixed-point number, MeasureFxP returns -0.0 instead of the correct value.

To Reproduce

Failing test case:

@Test("ToffoliSimulator")
operation FailingTest() : Unit {
    use qs = Qubit[4];
    let fxp = FixedPoint(2, qs);

    // bit pattern 00.00
    ApplyPauliFromBitString(PauliX, true, [false, false, false, false], qs);
    NearEqualityFactD(MeasureFxP(fxp), 0.0);

    // bit pattern 10.00
    ApplyPauliFromBitString(PauliX, true, [false, false, false, true], qs);
    NearEqualityFactD(MeasureFxP(fxp), -2.0);
}

Expected behavior
Test case should pass.

Metadata

Metadata

Assignees

Labels

Kind-BugSomething isn't workingPkg-NumericsIssue relates to the Microsoft.Quantum.Numerics package.trackingThis label will trigger gh-sync to create or update a mirror internal ADO issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions