[Bug fortran/117805] complex type, -Ofast and IEEE-754
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 29 21:35:34 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117805
--- Comment #19 from anlauf at gcc dot gnu.org ---
(In reply to kargls from comment #18)
> 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)
No.
comjg() is anti-linear, it has to be.
Fortran's cmplx is not exactly linear in the cases I discussed.
It should be linear to be consistent with complex analysis.
This is why I say the Fortran rules are broken.
More information about the Gcc-bugs
mailing list