]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc
d03075a6a4bdcf350fc89b28c8be6db9131ff942
1 // 2006-01-12 Paolo Carlini <pcarlini@suse.de>
3 // Copyright (C) 2006 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 8.1 Additions to header <complex>
23 #include <tr1/complex>
24 #include <testsuite_hooks.h>
25 #include <testsuite_tr1.h>
29 using namespace std::tr1
;
30 using namespace __gnu_test
;
32 typedef std::complex<float> cmplx_f_type
;
33 typedef std::complex<double> cmplx_d_type
;
34 typedef std::complex<long double> cmplx_ld_type
;
36 const float f1
= 1.0f
;
37 const double d1
= 1.0;
38 const long double ld1
= 1.0l;
40 const cmplx_f_type
c_f1(f1
, f1
);
41 const cmplx_d_type
c_d1(d1
, d1
);
42 const cmplx_ld_type
c_ld1(ld1
, ld1
);
44 check_ret_type
<float>(arg(f1
));
45 check_ret_type
<double>(arg(d1
));
46 check_ret_type
<long double>(arg(ld1
));
48 check_ret_type
<cmplx_f_type
>(conj(f1
));
49 check_ret_type
<cmplx_d_type
>(conj(d1
));
50 check_ret_type
<cmplx_ld_type
>(conj(ld1
));
52 check_ret_type
<float>(imag(f1
));
53 check_ret_type
<double>(imag(d1
));
54 check_ret_type
<long double>(imag(ld1
));
56 check_ret_type
<float>(norm(f1
));
57 check_ret_type
<double>(norm(d1
));
58 check_ret_type
<long double>(norm(ld1
));
60 check_ret_type
<cmplx_f_type
>(polar(f1
, f1
));
61 check_ret_type
<cmplx_d_type
>(polar(d1
, f1
));
62 check_ret_type
<cmplx_d_type
>(polar(f1
, d1
));
63 check_ret_type
<cmplx_d_type
>(polar(d1
, d1
));
64 check_ret_type
<cmplx_ld_type
>(polar(ld1
, d1
));
65 check_ret_type
<cmplx_ld_type
>(polar(d1
, ld1
));
66 check_ret_type
<cmplx_ld_type
>(polar(ld1
, f1
));
67 check_ret_type
<cmplx_ld_type
>(polar(f1
, ld1
));
68 check_ret_type
<cmplx_ld_type
>(polar(ld1
, ld1
));
70 check_ret_type
<cmplx_f_type
>(pow(c_f1
, f1
));
71 check_ret_type
<cmplx_d_type
>(pow(c_d1
, f1
));
72 check_ret_type
<cmplx_d_type
>(pow(c_f1
, d1
));
73 check_ret_type
<cmplx_d_type
>(pow(c_d1
, d1
));
74 check_ret_type
<cmplx_ld_type
>(pow(c_ld1
, d1
));
75 check_ret_type
<cmplx_ld_type
>(pow(c_d1
, ld1
));
76 check_ret_type
<cmplx_ld_type
>(pow(c_ld1
, f1
));
77 check_ret_type
<cmplx_ld_type
>(pow(c_f1
, ld1
));
78 check_ret_type
<cmplx_ld_type
>(pow(c_ld1
, ld1
));
80 check_ret_type
<cmplx_f_type
>(pow(f1
, c_f1
));
81 check_ret_type
<cmplx_d_type
>(pow(d1
, c_f1
));
82 check_ret_type
<cmplx_d_type
>(pow(f1
, c_d1
));
83 check_ret_type
<cmplx_d_type
>(pow(d1
, c_d1
));
84 check_ret_type
<cmplx_ld_type
>(pow(ld1
, c_d1
));
85 check_ret_type
<cmplx_ld_type
>(pow(d1
, c_ld1
));
86 check_ret_type
<cmplx_ld_type
>(pow(ld1
, c_f1
));
87 check_ret_type
<cmplx_ld_type
>(pow(f1
, c_ld1
));
88 check_ret_type
<cmplx_ld_type
>(pow(ld1
, c_ld1
));
90 check_ret_type
<cmplx_f_type
>(pow(c_f1
, c_f1
));
91 check_ret_type
<cmplx_d_type
>(pow(c_d1
, c_f1
));
92 check_ret_type
<cmplx_d_type
>(pow(c_f1
, c_d1
));
93 check_ret_type
<cmplx_d_type
>(pow(c_d1
, c_d1
));
94 check_ret_type
<cmplx_ld_type
>(pow(c_ld1
, c_d1
));
95 check_ret_type
<cmplx_ld_type
>(pow(c_d1
, c_ld1
));
96 check_ret_type
<cmplx_ld_type
>(pow(c_ld1
, c_f1
));
97 check_ret_type
<cmplx_ld_type
>(pow(c_f1
, c_ld1
));
98 check_ret_type
<cmplx_ld_type
>(pow(c_ld1
, c_ld1
));
100 check_ret_type
<float>(real(f1
));
101 check_ret_type
<double>(real(d1
));
102 check_ret_type
<long double>(real(ld1
));