[libstdc++-v3] Typo in std_complex.h (sqrt), patch included

Gabriel Dos Reis gdr@codesourcery.com
Sun Apr 1 00:00:00 GMT 2001


Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> writes:

| I believe there is a typo in line 467 of std_complex.h in function
| template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>& __z).
| The factor two should multiply the modulus of the complex number
| \emph{and} of the real part of that number. Otherwise incorrect results
| are obtained. For example without the patch the square root of 1 + i
| yields (0.978318,0.511081) instead of the correct result (1.09868,0.45509).

Thanks!

Benjamin, please could you install that patch?  Thanks in advance.

-- Gaby
CodeSourcery, LLC                       http://www.codesourcery.com


More information about the Libstdc++ mailing list