On Wed, Nov 13, 2024 at 3:05 PM Thomas Koenig <tkoe...@netcologne.de> wrote: > > Hello world, > > J3, the US Fortran standards committee, has passed > https://j3-fortran.org/doc/year/24/24-179.txt > which states (with a bit of an overabundance of > clarity) that, in Fortran, it is possible special-case > complex multiplication when one of the numbers is known > to have a zero component, for example when promoting > a real to complex for complex multiplication. For > example, multiplying a complex variable b with a real > variable a can be done with c%re = b%re * a, c%im = b%im * a, > without considering NaNs and infinities. Apparently, other > Fortran compilers do this. > > They also stated that ISO/IEC 60559:2020 (aka IEEE 754) does > not specify complex arithmetic (I wouldn't know, because it is a > paywalled standard). > > How do we want to deal with this? Do we want to implement this > (it's an obvious speed advantage)? Should it be the default? > Do we want to include this in -fcx-fortran-rules?
The middle-end complex lowering pass does this already, irrespective of NaNs, same for some degenerate cases with division. Richard. > Best regards > > Thomas > >