看看代码吹响:
#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;
}
Run Code Online (Sandbox Code Playgroud)
g ++(4.8.1)给出了输出
(nan,nan)
(-nan,-nan)
Run Code Online (Sandbox Code Playgroud)
而clang ++(3.3)给出了一个输出
(-nan,-nan)
(-nan,-nan)
Run Code Online (Sandbox Code Playgroud)
但我期待(1.0,0.0).
任何人都可以解释一下吗?