This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in complex::norm


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]