| 1 |
// { dg-do compile } |
| 2 |
|
| 3 |
// 2006-01-12 Paolo Carlini <[email protected]> |
| 4 |
// |
| 5 |
// Copyright (C) 2006-2025 Free Software Foundation, Inc. |
| 6 |
// |
| 7 |
// This file is part of the GNU ISO C++ Library. This library is free |
| 8 |
// software; you can redistribute it and/or modify it under the |
| 9 |
// terms of the GNU General Public License as published by the |
| 10 |
// Free Software Foundation; either version 3, or (at your option) |
| 11 |
// any later version. |
| 12 |
// |
| 13 |
// This library is distributed in the hope that it will be useful, |
| 14 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
// GNU General Public License for more details. |
| 17 |
// |
| 18 |
// You should have received a copy of the GNU General Public License along |
| 19 |
// with this library; see the file COPYING3. If not see |
| 20 |
// <http://www.gnu.org/licenses/>. |
| 21 |
|
| 22 |
// 8.1 Additions to header <complex> |
| 23 |
|
| 24 |
#include <tr1/complex> |
| 25 |
#include <testsuite_tr1.h> |
| 26 |
|
| 27 |
void test01() |
| 28 |
{ |
| 29 |
using __gnu_test::check_ret_type; |
| 30 |
|
| 31 |
typedef std::complex<float> cmplx_f_type; |
| 32 |
typedef std::complex<double> cmplx_d_type; |
| 33 |
typedef std::complex<long double> cmplx_ld_type; |
| 34 |
|
| 35 |
const float f1 = 1.0f; |
| 36 |
const double d1 = 1.0; |
| 37 |
const long double ld1 = 1.0l; |
| 38 |
|
| 39 |
const cmplx_f_type c_f1(f1, f1); |
| 40 |
const cmplx_d_type c_d1(d1, d1); |
| 41 |
const cmplx_ld_type c_ld1(ld1, ld1); |
| 42 |
|
| 43 |
check_ret_type<float>(std::tr1::arg(f1)); |
| 44 |
check_ret_type<double>(std::tr1::arg(d1)); |
| 45 |
check_ret_type<long double>(std::tr1::arg(ld1)); |
| 46 |
|
| 47 |
check_ret_type<cmplx_f_type>(std::tr1::conj(f1)); |
| 48 |
check_ret_type<cmplx_d_type>(std::tr1::conj(d1)); |
| 49 |
check_ret_type<cmplx_ld_type>(std::tr1::conj(ld1)); |
| 50 |
|
| 51 |
check_ret_type<float>(std::tr1::imag(f1)); |
| 52 |
check_ret_type<double>(std::tr1::imag(d1)); |
| 53 |
check_ret_type<long double>(std::tr1::imag(ld1)); |
| 54 |
|
| 55 |
check_ret_type<float>(std::tr1::norm(f1)); |
| 56 |
check_ret_type<double>(std::tr1::norm(d1)); |
| 57 |
check_ret_type<long double>(std::tr1::norm(ld1)); |
| 58 |
|
| 59 |
check_ret_type<cmplx_f_type>(std::tr1::polar(f1, f1)); |
| 60 |
check_ret_type<cmplx_d_type>(std::tr1::polar(d1, f1)); |
| 61 |
check_ret_type<cmplx_d_type>(std::tr1::polar(f1, d1)); |
| 62 |
check_ret_type<cmplx_d_type>(std::tr1::polar(d1, d1)); |
| 63 |
check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, d1)); |
| 64 |
check_ret_type<cmplx_ld_type>(std::tr1::polar(d1, ld1)); |
| 65 |
check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, f1)); |
| 66 |
check_ret_type<cmplx_ld_type>(std::tr1::polar(f1, ld1)); |
| 67 |
check_ret_type<cmplx_ld_type>(std::tr1::polar(ld1, ld1)); |
| 68 |
|
| 69 |
check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, f1)); |
| 70 |
check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, f1)); |
| 71 |
check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, d1)); |
| 72 |
check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, d1)); |
| 73 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, d1)); |
| 74 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, ld1)); |
| 75 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, f1)); |
| 76 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, ld1)); |
| 77 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, ld1)); |
| 78 |
|
| 79 |
check_ret_type<cmplx_f_type>(std::tr1::pow(f1, c_f1)); |
| 80 |
check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_f1)); |
| 81 |
check_ret_type<cmplx_d_type>(std::tr1::pow(f1, c_d1)); |
| 82 |
check_ret_type<cmplx_d_type>(std::tr1::pow(d1, c_d1)); |
| 83 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_d1)); |
| 84 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(d1, c_ld1)); |
| 85 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_f1)); |
| 86 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(f1, c_ld1)); |
| 87 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(ld1, c_ld1)); |
| 88 |
|
| 89 |
check_ret_type<cmplx_f_type>(std::tr1::pow(c_f1, c_f1)); |
| 90 |
check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_f1)); |
| 91 |
check_ret_type<cmplx_d_type>(std::tr1::pow(c_f1, c_d1)); |
| 92 |
check_ret_type<cmplx_d_type>(std::tr1::pow(c_d1, c_d1)); |
| 93 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_d1)); |
| 94 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_d1, c_ld1)); |
| 95 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_f1)); |
| 96 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_f1, c_ld1)); |
| 97 |
check_ret_type<cmplx_ld_type>(std::tr1::pow(c_ld1, c_ld1)); |
| 98 |
|
| 99 |
check_ret_type<float>(std::tr1::real(f1)); |
| 100 |
check_ret_type<double>(std::tr1::real(d1)); |
| 101 |
check_ret_type<long double>(std::tr1::real(ld1)); |
| 102 |
} |