[PATCH, libstdc++, complex] complex multiplication algorithm improved
Marc Glisse
marc.glisse@inria.fr
Wed Sep 15 09:21:00 GMT 2010
On Wed, 15 Sep 2010, Paolo Carlini wrote:
> ... note that we are talking about the code *in the primary template*,
> not in the specializations for float / double / long double and that the
> behavior when instantiating with anything else outside float / double /
> long double is *unspecified* in the Standard.
For float/double/long double, the code with 3 multiplications is actually
significantly slower on many architectures (including x86 and x86_64)
because of all the extra additions. So it only makes sense if you expect
complex<T> to be used mostly with T that has costly multiplications
(double on some archs, multi-precision, etc).
--
Marc Glisse
More information about the Libstdc++
mailing list