From gcc-patches Thu Sep 16 08:45:52 2010 From: Wang Feng Date: Thu, 16 Sep 2010 08:45:52 +0000 To: gcc-patches Subject: Fwd: [PATCH, libstdc++, complex] complex multiplication algorithm improved Message-Id: X-MARC-Message: https://marc.info/?l=gcc-patches&m=128462708711326 From: Wang Feng Date: 16 September 2010 16:38 Subject: Re: [PATCH, libstdc++, complex] complex multiplication algorithm improved To: Gabriel Dos Reis On 15 September 2010 21:39, Gabriel Dos Reis wrote: > Hi, > I would like to see more data to support the change. > (I apologize if the mere mention of "numerical recipe" > does not move me.) > I am in no way claiming that the current implementation > in all conceivable aspects.  However, I think we need to > have "good" reasons to move the implementation one > way or the other.   I also think we should be using > builtin __complex__ T for standard integer type T. > I have to admit this will slow down our program while using float/double/long double, but I guess situation might be better for old-styled cpus. BTW,  would you please take a look at Eq. 5.4.4 - 5.4.7 in http://www.haoli.org/nr/bookcpdf/c5-4.pdf ? I noticed abs is precision-optimized for all types, but this kind of optimization leads abs(complex(3,4)) to 4, not 5, while division and square root functions are not optimized for float/double/long double. sorry for the noise.