[Bug libstdc++/50880] __complex_acosh() picks wrong complex branch
gdr at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 2 12:23:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50880
Gabriel Dos Reis <gdr at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu.org
--- Comment #13 from Gabriel Dos Reis <gdr at gcc dot gnu.org> 2011-11-02 12:22:26 UTC ---
(In reply to comment #2)
> Thus, to understand and clarify why this has not been noticed so far, you are
> on a target which doesn't support in the underlying C library these complex
> functions, right? Because normally (eg, on Linux) these days we just forward to
> __builtin_cacosh*, the code you are touching is just a "surrogate", a
> "fallback", which doesn't get right all the special cases, NaNs, infinity.
>
> Anyway, a similar tweak would touch also the C++11 version in std::
>
> Gaby, can you have a look to this, double check the patch? For your convenience
> the surrounding code is:
>
> template<typename _Tp>
> std::complex<_Tp>
> __complex_acosh(const std::complex<_Tp>& __z)
> {
> std::complex<_Tp> __t((__z.real() - __z.imag())
> * (__z.real() + __z.imag()) - _Tp(1.0),
> _Tp(2.0) * __z.real() * __z.imag());
> __t = std::sqrt(__t);
>
> return std::log(__t + __z);
> }
As I observed elsewhere, the test should be on the sign, no comparison
against 0.0, so that signed zero is handled correctly.
More information about the Gcc-bugs
mailing list