Bug in complex::norm

nbecker@fred.net nbecker@fred.net
Wed Aug 22 04:58:00 GMT 2001


>>>>> "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);
}



More information about the Gcc mailing list