This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Bug in complex::norm
- To: gcc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: Bug in complex::norm
- From: nbecker at fred dot net
- Date: 21 Aug 2001 13:46:42 -0400
I just updated to gcc-3.0.1 and found a problem with the
implementation of complex::norm.
It seems that norm is now defined in terms of abs! This is not
efficient and is wrong for non-float types.
The definition of norm should be
template<typename T>
inline T norm (const complex<T>& z) {
return real (z) * real (z) + imag (z) * imag (z)
}