qrisp.QuantumFloat.significant#

QuantumFloat.significant(k)[source]#

Returns the qubit with significance \(k\).

Parameters:
kint

The significance.

Returns:
Qubit

The Qubit with significance \(k\).

Raises:
Exception

Tried to retrieve invalid significant from QuantumFloat

Examples

We create a QuantumFloat and flip a qubit of specified significance.

>>> from qrisp import QuantumFloat, x
>>> qf = QuantumFloat(6, -3)
>>> x(qf.significant(-2))
>>> print(qf)
{0.25: 1.0}

The qubit with significance \(-2\) corresponds to the value \(0.25 = 2^{-2}\).

>>> x(qf.significant(2))
{4.25: 1.0}

The qubit with significance \(2\) corresponds to the value \(4 = 2^{2}\).