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.

Functions for smallest and largest representable fixed point #594

Description

Functions for smallest and largest representable fixed point

Conceptual overview

This provides two functions to return the smallest and largest representable fixed point based on number of integer and fractional bits.

This should be added to the Numerics package.

Proposal

New and modified functions, operations, and UDTs

namespace Microsoft.Quantum.Math {

/// # Summary
/// Returns the smallest representable number for specific fixed point dimensions
///
/// # Input
/// ## integerBits
/// Number of integer bits
/// ## fractionalBits
/// Number of fractional bits
///
/// # Remark
/// The value can be computed as $-2^{p-1}$, where $p$ is the number of integer bits.
function SmallestFixedPoint(integerBits : Int, fractionalBits : Int) : Double { ... }

/// # Summary
/// Returns the largest representable number for specific fixed point dimensions
///
/// # Input
/// ## integerBits
/// Number of integer bits
/// ## fractionalBits
/// Number of fractional bits
///
/// # Remark
/// The value can be computed as $2^{p-1} - 2^{-q}$, where $p$
/// is the number of integer bits and $q$ is the number of fractional bits.
function LargestFixedPoint(integerBits : Int, fractionalBits : Int) : Double { ... }

}

Open questions

Which namespace fits well?

  • Microsoft.Quantum.Arithmetic
  • Microsoft.Quantum.Canon
  • Microsoft.Quantum.Math

Activity

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

Metadata

Metadata

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