[flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.transcendentals / log10.pass.cpp
blob78818f0de15b2bd37a4f7573ac1155216373a4bb
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // <complex>
11 // template<class T>
12 // complex<T>
13 // log10(const complex<T>& x);
15 #include <complex>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "../cases.h"
21 template <class T>
22 void
23 test(const std::complex<T>& c, std::complex<T> x)
25 assert(log10(c) == x);
28 template <class T>
29 void
30 test()
32 test(std::complex<T>(0, 0), std::complex<T>(-INFINITY, 0));
35 void test_edges()
37 const unsigned N = sizeof(testcases) / sizeof(testcases[0]);
38 for (unsigned i = 0; i < N; ++i)
40 std::complex<double> r = log10(testcases[i]);
41 std::complex<double> z = log(testcases[i])/std::log(10);
42 if (std::isnan(real(r)))
43 assert(std::isnan(real(z)));
44 else
46 assert(real(r) == real(z));
47 assert(std::signbit(real(r)) == std::signbit(real(z)));
49 if (std::isnan(imag(r)))
50 assert(std::isnan(imag(z)));
51 else
53 assert(imag(r) == imag(z));
54 assert(std::signbit(imag(r)) == std::signbit(imag(z)));
59 int main(int, char**)
61 test<float>();
62 test<double>();
63 test<long double>();
64 test_edges();
66 return 0;