https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61761
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Wed May 1 00:08:36 2019 New Revision: 270759 URL: https://gcc.gnu.org/viewcvs?rev=270759&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. 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: trunk/libstdc++-v3/testsuite/26_numerics/complex/proj.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/std/complex