From a27781113c538527cc6798481ceaadb62286a55b Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 4 Apr 2016 16:08:54 +0000 Subject: [PATCH] Fix for Bug #27193; 'std::acos on complex does not agree with C'. Tests need work; so the bug will stay open. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@265306 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/complex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/complex b/include/complex index 2943da1d7..565e1114a 100644 --- a/include/complex +++ b/include/complex @@ -1399,7 +1399,7 @@ acos(const complex<_Tp>& __x) } if (isinf(__x.imag())) return complex<_Tp>(__pi/_Tp(2), -__x.imag()); - if (__x.real() == 0) + if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag()))) return complex<_Tp>(__pi/_Tp(2), -__x.imag()); complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); if (signbit(__x.imag()))