[Bug middle-end/122082] complex multiply: w * conj(w) should have zero imaginary part
kargls at comcast dot net
gcc-bugzilla@gcc.gnu.org
Fri Oct 3 00:11:40 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122082
--- Comment #6 from kargls at comcast dot net ---
(In reply to Fred J. Tydeman from comment #3)
> Complex multiply:
>
> w * conj(w)
> == (x+I*y)*(x-I*y)
> == [x*x - (I*y)*(I*y)] + [I*x*y-I*x*y]
> == [x*x - (I*I)*(y*y)] + [I*(x*y-*x*y)]
> == [x*x - (-1)*(y*y)] + [I*(0)]
> == [x*x + y*y] + I*0
>
> So, the imaginary part of the product should be 0.
Yes, that's the mathematics of complex multiplication.
Now, can you answer the question from comment #2.
IOW, your program is flawed.
More information about the Gcc-bugs
mailing list