]> gcc.gnu.org Git - gcc.git/blame - libstdc++-v3/testsuite/26_numerics/complex/13450.cc
libstdc++.exp: Load target-supports-dg.exp.
[gcc.git] / libstdc++-v3 / testsuite / 26_numerics / complex / 13450.cc
CommitLineData
75d1ddc1
JJ
1// { dg-do run { xfail { powerpc*-*-linux* && broken_cplxf_arg } } }
2
52ddaf41
PK
3// Copyright (C) 2004 Free Software Foundation
4//
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)
9// any later version.
10
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.
15
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19// USA.
20
21// 26.2.8 complex transcendentals
22
23#include <complex>
24#include <limits>
25#include <testsuite_hooks.h>
26
27template<typename T>
28 void test01_do(T a, T b)
29 {
30 using namespace std;
31 bool test __attribute__((unused)) = true;
32 typedef complex<T> cplx;
33
c6feb697 34 T eps = numeric_limits<T>::epsilon() * 100;
52ddaf41
PK
35
36 cplx ref = pow(cplx(a, T()), cplx(b, T()));
37 cplx res1 = pow(a, cplx(b, T()));
38 cplx res2 = pow(cplx(a, T()), b);
39
40 VERIFY( abs(ref - res1) < eps );
41 VERIFY( abs(ref - res2) < eps );
42 VERIFY( abs(res1 - res2) < eps );
43 }
44
45// libstdc++/13450
46void test01()
47{
48 float f1 = -1.0f;
49 float f2 = 0.5f;
50 test01_do(f1, f2);
51
52 f1 = -3.2f;
53 f2 = 1.4f;
54 test01_do(f1, f2);
55
56 double d1 = -1.0;
57 double d2 = 0.5;
58 test01_do(d1, d2);
59
60 d1 = -3.2;
61 d2 = 1.4;
62 test01_do(d1, d2);
63
64 long double ld1 = -1.0l;
65 long double ld2 = 0.5l;
66 test01_do(ld1, ld2);
67
68 ld1 = -3.2l;
69 ld2 = 1.4l;
70 test01_do(ld1, ld2);
71}
72
73int main()
74{
75 test01();
76 return 0;
77}
This page took 0.130871 seconds and 5 git commands to generate.