[libcxx] r265306 - Fix for Bug #27193; 'std::acos on complex does not agree with C'. Tests need work; so the bug will stay open.

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 09:08:54 PDT 2016


Author: marshall
Date: Mon Apr  4 11:08:54 2016
New Revision: 265306

URL: http://llvm.org/viewvc/llvm-project?rev=265306&view=rev
Log:
Fix for Bug #27193; 'std::acos on complex does not agree with C'. Tests need work; so the bug will stay open.


Modified:
    libcxx/trunk/include/complex

Modified: libcxx/trunk/include/complex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/complex?rev=265306&r1=265305&r2=265306&view=diff
==============================================================================
--- libcxx/trunk/include/complex (original)
+++ libcxx/trunk/include/complex Mon Apr  4 11:08:54 2016
@@ -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()))




More information about the cfe-commits mailing list