https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89991
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > The issue is > > std::pow<double> (__x=..., __y=@0x7fffffffdcb8: 0.5) > at /home/space/rguenther/install/gcc-9.0/include/c++/9.0.1/complex:1027 > (gdb) l > 1022 { > 1023 #if ! _GLIBCXX_USE_C99_COMPLEX > 1024 if (__x == _Tp()) > 1025 return _Tp(); > 1026 #endif > 1027 if (__x.imag() == _Tp() && __x.real() > _Tp()) > 1028 return pow(__x.real(), __y); > > where __x.imag () == _Tp() says true for -0.0 == 0.0. This means > std::pow will return the same values for r + -0.0i and r + 0.0i, > not sure if that is allowed by the C++ standard. But __x.real() > _Tp() is false here, so that branch isn't taken anyway. Instead the pow(val, 0.5) result comes from: _Complex double val = -1.8425031517782417e-07 + -0.0 * I; _Complex double t = __builtin_clog(val); double rho = exp(0.5 * __real__ t); double theta = 0.5 * __imag__ t; _Complex result = rho * cos(theta) + rho * sin(theta) * I; __builtin_printf("%f\n", __imag__ result);