How can I round up a complex number (e.g. 1.9999999999999998-2j
) as 2-2j
?
When I tried using
print(round(x,2))
it showed
Traceback (most recent call last):
File "C:Python34FFT.py", line 22, in <module>
print(round(x,2))
TypeError: type complex doesn't define __round__ method
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…