Greetings, fellow GNU hackers.
Consider the following program,
#include <iostream>
#include <iomanip>
#include <cmath>
#include <complex>
int main(){
using namespace std;
cout << setprecision(16) << pow(complex<double>(0,1), 2) << endl;
}
Compile it with and without -std=c++0x:
jordi@Iris:~$ g++ foo.c++ -o foo && ./foo
(-1,0)
jordi@Iris:~$ g++ foo.c++ -o foo -std=c++0x && ./foo
(-1,1.224646799147353e-16)
The round-off error introduced by C++11 is partly due to the following
discussion:
http://stackoverflow.com/questions/5627030/why-was-stdpowdouble-int-removed-from-c11
For some reason, the pow(complex<T>, int) overload seems to be
missing in C++11, but it doesn't seem like the standard says it should
be. Can it be restored in GNU libstdc++ for C++11?