BoolArrayAsFixedPoint function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Convert

Package: Microsoft.Quantum.Numerics

Returns the double value of a fixed-point approximation from of a Bool array.

function BoolArrayAsFixedPoint (integerBits : Int, bits : Bool[]) : Double

Input

integerBits : Int

Assumed number of integer bits (including the sign bit).

bits : Bool[]

Bit-string representation of approximated number.

Output : Double

Example

Note that the first element in the Boolean array is the least-significant bit.

let value = BoolArrayAsFixedPoint(2, [true, false, true, false]); // value =  1.25
let value = BoolArrayAsFixedPoint(2, [true, false, false, true]); // value = -1.75