1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // atan(const complex<T>& x);
18 #include "test_macros.h"
23 test(const std::complex<T
>& c
, std::complex<T
> x
)
32 test(std::complex<T
>(0, 0), std::complex<T
>(0, 0));
37 const unsigned N
= sizeof(testcases
) / sizeof(testcases
[0]);
38 for (unsigned i
= 0; i
< N
; ++i
)
40 std::complex<double> r
= atan(testcases
[i
]);
41 std::complex<double> t1(-imag(testcases
[i
]), real(testcases
[i
]));
42 std::complex<double> t2
= atanh(t1
);
43 std::complex<double> z(imag(t2
), -real(t2
));
44 if (std::isnan(real(r
)))
45 assert(std::isnan(real(z
)));
48 assert(real(r
) == real(z
));
49 assert(std::signbit(real(r
)) == std::signbit(real(z
)));
51 if (std::isnan(imag(r
)))
52 assert(std::isnan(imag(z
)));
55 assert(imag(r
) == imag(z
));
56 assert(std::signbit(imag(r
)) == std::signbit(imag(z
)));