On 03/05/19 09:23 +0000, Szabolcs Nagy wrote:
On 01/05/2019 01:09, Jonathan Wakely wrote:
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.

Tested powerpc64le-linux, powerpc-aix7.2.0.0, x86_64-freebsd11.2,
committed to trunk.

fails on aarch64-none-elf (newlib) with

FAIL: 26_numerics/complex/proj.cc (test for excess errors)
Excess errors:
/work/b/src/gcc/libstdc++-v3/testsuite/26_numerics/complex/proj.cc:32: error: 
'copysign' is not a member of 'std'; did you mean 'copy_n'?
/work/b/src/gcc/libstdc++-v3/testsuite/26_numerics/complex/proj.cc:32: error: 
'copysign' is not a member of 'std'; did you mean 'copy_n'?
/work/b/src/gcc/libstdc++-v3/testsuite/26_numerics/complex/proj.cc:34: error: 
'copysign' is not a member of 'std'; did you mean 'copy_n'?
/work/b/src/gcc/libstdc++-v3/testsuite/26_numerics/complex/proj.cc:34: error: 
'copysign' is not a member of 'std'; did you mean 'copy_n'?

i assume std::copysign should be visible in <complex> via <cmath>

It should, but only for C++11, and this needs to work for C++98 too. I
missed that problem.

but cmath does not have it.

Hmm, which file in the source tree does the include/cmath symlink in
the build tree point to?


Reply via email to