看一下自爆的代码:
#include <complex>
#include <iostream>
int main()
{
std::cout << std::pow( std::complex<double>(0,0), std::complex<double>(0,0) ) << "\n";
std::cout << std::pow( std::complex<double>(0,0), double(0) ) << "\n";
return 0;
}
g++(4.8.1) 给出的输出为
(nan,nan)
(-nan,-nan)
而 clang++(3.3) 给出了一个输出
(-nan,-nan)
(-nan,-nan)
但我期待(1.0,0.0)。
谁能给个解释?