https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56106
Alexander Voigt <Alexander.Voigt at desy dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Alexander.Voigt at desy dot de --- Comment #1 from Alexander Voigt <Alexander.Voigt at desy dot de> --- I would like to support the suggestion 2 to add overloads for pow(complex,scalar) when scalar is an integer type. The reason is that if scalar is an integer type (but not int), the function pow(complex,scalar) produces (unnecessarily) imprecise results. Here is an example where scalar is of type int64_t: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include <complex> #include <cmath> #include <iostream> #include <iomanip> int main() { const std::complex<double> z(0.0, -0.9272952180016123); const int64_t n = -11; // precise result if n is of type int std::cout << std::setprecision(17) << std::pow(-z, n) << '\n'; // Output: (-5.6202077021041968e-15,2.2940441836319949) // Expected output: (-0,2.2940441836319949) } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The output of this code snipped when compiling with gcc version 10.2.1 20210110 (Debian 10.2.1-6) as g++ bug.cpp ./a.out gives the imprecise real part -5.6202077021041968e-15 (expected real part: 0.0). When n is changed to type int, the real part is exactly 0.0, as expected. Adding overloads for (non-int) integral types would thus improve the precision of the output.