https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117805

--- Comment #18 from kargls at comcast dot net ---
On 11/29/24 11:19, anlauf at gcc dot gnu.org wrote:
>> The '-' is an unary minus operator.  In 'cmplx(-1.)', it operates
>> on only the real part.  In  '- cmplx(1.)', it operates on both
>> parts.  I don't see anything anti-linear here.
> OK, then try:
> 
>    print *, cmplx (-1. * (-1.)), cmplx (-1.) * cmplx (-1.)
> 
> which gives:
> 
>               (1.00000000,0.00000000)            (1.00000000,-0.00000000)
> 
> This is why I said "slightly anti-linear".

I have no idea what you're trying to demonstrate.
By F2023, 16.9.53 if x is real in cmplx(x), then
y is set to 0.  In addition, actual arguments are
evaluated on entry into a function.

cmplx(-1.*(-1.)) -16.9.53-> (1., 0.)

cmplx (-1.)*cmplx (-1.) -16.9.53-> (-1., 0) * (-1., 0)

((-1)*(-1)-(0)*(0), (-1)*(0)+(0)*(-1)) = (1-0, -0-0) = (1, -0)


With z complex, in general z*z /= x**2 + y**2.  Perhaps, you meant
to write

    print *, cmplx (-1. * (-1.)), cmplx (-1.) * conjg(cmplx (-1.))

              (1.00000000,0.00000000)             (1.00000000,0.00000000)

Reply via email to