<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - std::acos on complex does not agree with C"
href="https://llvm.org/bugs/show_bug.cgi?id=27193">27193</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>std::acos on complex does not agree with C
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>j.o.e.lpublic@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider the following:
$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
$ cat x.cc
#include <iostream>
#include <complex>
int main()
{
std::complex<double> x(0,3.14159265359);
std::cout << std::acos(x) << std::endl;
std::cout << std::cos(std::acos(x)) << std::endl;
return 0;
}
$ clang++ -std=c++11 x.cc
$ ./a.out
(1.5708,-3.14159)
(7.09802e-16,11.5487)
$ cat z.c
#include <math.h>
#include <complex.h>
#include <stdio.h>
int main()
{
complex double z=0+3.14159*I;
complex double r=cacos(z);
complex double rr=ccos(r);
printf("%e %e\n",creal(r),cimag(r));
printf("%e %e\n",creal(rr), cimag(rr));
return 0;
}
$ clang -std=c99 z.c
$ ./a.out
1.570796e+00 -1.862295e+00
2.018773e-16 3.141590e+00
Compiling programs on linux with clang (and gnu standard libs) has C and C++ in
agreement.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>