[llvm-bugs] [Bug 27193] New: std::acos on complex does not agree with C
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 3 21:19:53 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27193
Bug ID: 27193
Summary: std::acos on complex does not agree with C
Product: libc++
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: j.o.e.lpublic at gmail.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Classification: Unclassified
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160404/ee12812e/attachment.html>
More information about the llvm-bugs
mailing list