The following
#include <iostream>
#include <complex>
int main()
{
std::complex<double> i (0,1);
std::complex<double> comp =pow(i, 2 );
std::cout<<comp<<std::endl;
return 0;
}
gives the expected result (-1.0) without C ++ 11. However, compiling with C ++ 11 gives a very annoying (-1.1.22461e-016).
What to do and what is best?
Of course, this can be fixed manually with floor coverings, etc., but I would appreciate the correct way to solve the problem.
SYSTEM: Win8.1 using Desktop Qt 5.1.1 (Qt Creator) with MinGW 4.8 32 bits. Using C ++ 11, adding the flag QMAKE_CXXFLAGS + = -std = C ++ 11 to the .pro file.
source
share