This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] PR libstdc++/61761 fix std::proj for targets without C99 cproj
- From: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: nd <nd at arm dot com>
- Date: Fri, 3 May 2019 09:23:45 +0000
- Subject: Re: [PATCH] PR libstdc++/61761 fix std::proj for targets without C99 cproj
- References: <20190501000944.GA8388@redhat.com>
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>
but cmath does not have it.