https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61761
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Thu Oct 24 12:55:21 2019 New Revision: 277392 URL: https://gcc.gnu.org/viewcvs?rev=277392&root=gcc&view=rev Log: PR libstdc++/61761 fix std::proj for targets without C99 cproj The current generic implementation of __complex_proj used when cproj is not available calculates the wrong projection, giving a different result than given by C99's cproj. When C99 cproj is not available but isinf and copysign are, use those to give correct results for float, double and long double. Otherwise, and for other specializations of std::complex, just use a generic version that returns its argument, and so doesn't support infinities. We might want to consider adding additional overloads of __complex_proj to support extended types such as _Float64x, _Float128 etc. Backport from mainline 2019-05-01 Jonathan Wakely <jwak...@redhat.com> PR libstdc++/61761 * include/std/complex (__complex_proj): Return parameter unchanged. [_GLIBCXX_USE_C99_COMPLEX] (__complex_proj): Change overloads for floating-point types to take std::complex arguments. [_GLIBCXX_USE_C99_MATH_TR1] (__complex_proj): Add overloads for floating-point types. * testsuite/26_numerics/complex/proj.cc: New test. Added: branches/gcc-9-branch/libstdc++-v3/testsuite/26_numerics/complex/proj.cc Modified: branches/gcc-9-branch/libstdc++-v3/ChangeLog branches/gcc-9-branch/libstdc++-v3/include/std/complex