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.

Conversion functions for signed integers #595

@msoeken

Description

@msoeken

Conversion functions for signed integers

Conceptual overview

Returns Boolean arrays based on two's complement representations of signed integers.

This should be added to the Numerics package.

Proposal

New and modified functions, operations, and UDTs

namespace Microsoft.Quantum.Convert {

/// # Summary
/// Computes signed integer of two's complement encoding.
function BoolArrayAsSignedInt(bits : Bool[]) : Int { ... }

/// # Summary
/// Computes two's complement encoding as bit array from signed integer
function SignedIntAsBoolArray(number : Int, numBits : Int) : Bool[] { ... }

}

Other functions

The following functions are related and might be discussed in a future API proposal:

namespace Microsoft.Quantum.Convert {

/// # Summary
/// Returns signed integer from bit encoding of unsigned integer
function IntAsSignedInt(number : Int, numBits : Int) : Int { ... }

/// # Summary
/// Returns unsigned integer from bit encoding of signed integer
function SignedIntAsInt(number : Int, numBits : Int) : Int { ... }

}

(see also discussion in the comments)

Metadata

Metadata

Assignees

Labels

Area-APIIssue concerns the API design of a library, such as style guide or design principles adherence.Kind-EnhancementNew feature or requestPkg-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