http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60646
--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, Mar 25, 2014 at 08:57:56PM +0000, dominiq at lps dot ens.fr wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60646 > > --- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > Created attachment 32456 > --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32456&action=edit > an "improved" complex division > > Another variation on the same theme! > > The test prints the results for the default complex division, the expected > results, and the difference between the "improved" version and the expected > one > (note that with -O1 and above the constants are folded). Thanks for coding up the improved algorithm. Note, I placed the default division (ie, z = z1 / z2) in my cdiv.f90 to prevent the compiler for possibly inlining and possibly doing other optimizations. I don't know if it affects your results. PS: -ffast-math uses the naive complex division, which gives rather amusing results.