This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in complex::norm
>>>>> "Gabriel" == Gabriel Dos Reis <gdr@codesourcery.com> writes:
Gabriel> I don't recall if I changed norm's implementation, and if so I don't
Gabriel> recall why. But we should have a less inefficient implementation.
Here is the implementation from gcc-2.95.2 (actually from 2.96
20000731 Red Hat Linux 7.1 2.96-85, but I don't think that matters):
template <class _FLT> inline _FLT
norm (const complex<_FLT>& x) __attribute__ ((const));
template <class _FLT> inline _FLT
norm (const complex<_FLT>& x)
{
return real (x) * real (x) + imag (x) * imag (x);
}