Issue 1168: complex arithmetic: strange results with "imag" (original) (raw)

Issue1168

Created on 2007-09-16 07:31 by newman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg55940 - (view) Author: Nusret BALCI (newman) Date: 2007-09-16 07:31
"imag" returns incorrect results if invoked on a literal number. Looks like a bug. >>> 1-2j (1-2j) >>> 1-2j.real 1.0 >>> 1-2j.imag -1.0 >>> 1-4j.imag -3.0 >>> (1-4j).imag -4.0 >>>
msg55941 - (view) Author: Gabriel Genellina (ggenellina) Date: 2007-09-16 08:13
Note that there are no complex literals in Python, only imaginary literals. 1-4j is an expression, not a literal. So 1-4j.imag means 1-(4j.imag) = 1-4 = -3 See http://docs.python.org/ref/numbers.html#l2h-16 (I'd close this as not a bug)
msg55942 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-09-16 08:19
Exactly.
History
Date User Action Args
2022-04-11 14:56:26 admin set github: 45509
2007-09-16 08:19:54 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: not a bug
2007-09-16 08:13:23 ggenellina set nosy: + ggenellinamessages: +
2007-09-16 07:31:20 newman create