qrisp.q_round#
- q_round(a: QuantumFloat) QuantumFloat[source]#
Computes out-of-place the rounding of a QuantumFloat to the first significant digit.
- Parameters:
- aQuantumFloat
- Returns:
- QuantumFloat
The rounding of
a.
Examples
>>> from qrisp import * >>> a = QuantumFloat(4,-2) >>> a[:] = {0.25: 0.25**0.5, 1.75: 0.75**0.5} >>> b = q_round(a) >>> b.get_measurement() {2.0: 0.75, 0.0: 0.25}
Warning
Rounding operations that would result in overflow, raise no errors. Instead, the operations are performed modular.