http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50880
--- Comment #23 from Richard B. Kreckel <kreckel at ginac dot de> 2011-11-03 23:57:55 UTC --- (In reply to comment #16) > Well, I guess this would be most of it: > > template<typename _Tp> > std::complex<_Tp> > __complex_acosh(const std::complex<_Tp>& __z) > { > return _Tp(2.0) * std::log(std::sqrt(_Tp(0.5) * (__z + _Tp(1.0))) > + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0)))); > } [Sorry for my temporary absence.] For future reference, some final remarks: * Yes, that is a good implementation for this "fallback". It relies on __z - _Tp(1.0) not "mutating" the sign of __z's imag part. * If the complex log does not do the right thing, all is lost anyways (besides, __complex_asinh relies on it, too). * My patch BC1 was flawed. It contains code trying to work around a ctor doing multiplication (fixed in PR48760) * My patch BC2 was flawed for the same reason: __z - __one doesn't preserve the sign of __z's imag part. Looks good. Thanks!