[PATCH] PR libstdc++/61761 fix std::proj for targets without C99 cproj
Jonathan Wakely
jwakely@redhat.com
Fri May 3 11:16:00 GMT 2019
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?
More information about the Libstdc++
mailing list