Qiskit: rounding with get_statevector does not work?

I am trying to follow some tutorials for Qiskit and came to the point where I wanted to get some statevector containing $$1/\sqrt{2}$$ with the following line of code:

outputstate = result.get_statevector(circ, decimals=3)

By specifying the option decimals=3, it should round the numerical value in the statevector to 0.707. However, it does not do that. Instead, what is displayed is 0.70710678+0.jas it apparently fails to round.

What could be the problem causing this? Or how else could I resolve this issue to get nicer looking results when displayed?

• Which version are you using? It seems that problem was solved in qiskit-terra 0.17 github.com/Qiskit/qiskit-terra/issues/5428 – luciano Jul 9 at 10:40
• I just updated to qiskit-terra 0.17.4 and now it is working properly again. – Tobias95 Jul 9 at 10:52

If you are simply looking to format the results, you can use Python's f strings, for example print(f'{outputstate:.3f}') would print outputstate to 3 decimal places.