aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2006-01-15 17:52:36 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2006-01-15 17:52:36 +0000
commitfd22159fe7d37e7b709c36eb264b54c7ca81e182 (patch)
tree14444be8e89bd889d07d4c47311c867f77a3f47b /libstdc++-v3/testsuite
parent02f08d219a3133e58fbac5d4e5f0ae1b96aeda21 (diff)
downloadgcc-fd22159fe7d37e7b709c36eb264b54c7ca81e182.zip
gcc-fd22159fe7d37e7b709c36eb264b54c7ca81e182.tar.gz
gcc-fd22159fe7d37e7b709c36eb264b54c7ca81e182.tar.bz2
overloads_int.cc: Fix norm test, use casts everywhere.
2006-01-15 Paolo Carlini <pcarlini@suse.de> * testsuite/tr1/8_c_compatibility/complex/overloads_int.cc: Fix norm test, use casts everywhere. From-SVN: r109725
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc52
1 files changed, 29 insertions, 23 deletions
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
index c5fcd84..07b2f92 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
@@ -37,53 +37,59 @@ void test01()
const unsigned u1 = 1;
const long l1 = 1;
const double f1 = 1.0f;
- const double d0 = 0.0;
const double d1 = 1.0;
check_ret_type<double>(arg(i1));
- VERIFY( arg(i1) == arg(d1) );
- VERIFY( arg(i1) == arg(cmplx_d_type(d1, d0)) );
+ VERIFY( arg(i1) == arg(double(i1)) );
+ VERIFY( arg(i1) == arg(cmplx_d_type(double(i1))) );
check_ret_type<cmplx_d_type>(conj(i1));
- VERIFY( conj(i1) == conj(d1) );
- VERIFY( conj(i1) == conj(cmplx_d_type(d1, d0)) );
+ VERIFY( conj(i1) == conj(double(i1)) );
+ VERIFY( conj(i1) == conj(cmplx_d_type(double(i1))) );
check_ret_type<double>(imag(i1));
- VERIFY( imag(i1) == imag(d1) );
- VERIFY( imag(i1) == imag(cmplx_d_type(d1, d0)) );
+ VERIFY( imag(i1) == imag(double(i1)) );
+ VERIFY( imag(i1) == imag(cmplx_d_type(double(i1))) );
check_ret_type<double>(norm(i1));
- VERIFY( norm(i1) == norm(d1) );
- VERIFY( norm(i1) == norm(cmplx_d_type(d1, d0)) );
+ VERIFY( norm(i1) == norm(double(i1)) );
+ // std::norm<const complex<>&) is mathematically equivalent to just
+ // this for a real, but the general algorithm goes through std::abs
+ // and a multiplication.
+ VERIFY( norm(i1) == double(i1) * double(i1) );
check_ret_type<cmplx_d_type>(polar(i1, i1));
- VERIFY( polar(i1, i1) == polar(d1, d1) );
-
- // NB: According to the letter of 8.1.9/3 the return type
- // should be a cmplx_d_type, but the existing overload
- // std::pow(const complex<>&, int) wins.
+ VERIFY( polar(i1, i1) == polar(double(i1), double(i1)) );
+ // NB: According to the letter of 8.1.9/3 the return type should be a
+ // cmplx_d_type, but the existing std::pow(const complex<>&, int) wins.
check_ret_type<cmplx_f_type>(pow(cmplx_f_type(f1, f1), i1));
check_ret_type<cmplx_d_type>(pow(cmplx_f_type(f1, f1), u1));
check_ret_type<cmplx_d_type>(pow(cmplx_f_type(f1, f1), l1));
check_ret_type<cmplx_d_type>(pow(cmplx_d_type(d1, d1), i1));
- // See above comment.
- // VERIFY( pow(cmplx_d_type(d1, d1), i1) == pow(cmplx_d_type(d1, d1), d1) );
- VERIFY( pow(cmplx_d_type(d1, d1), u1) == pow(cmplx_d_type(d1, d1), d1) );
- VERIFY( pow(cmplx_d_type(d1, d1), l1) == pow(cmplx_d_type(d1, d1), d1) );
+ // See last comment.
+ // VERIFY( pow(cmplx_d_type(d1, d1), i1)
+ // == pow(cmplx_d_type(d1, d1), double(i1)) );
+ VERIFY( pow(cmplx_d_type(d1, d1), u1)
+ == pow(cmplx_d_type(d1, d1), double(u1)) );
+ VERIFY( pow(cmplx_d_type(d1, d1), l1)
+ == pow(cmplx_d_type(d1, d1), double(l1)) );
check_ret_type<cmplx_d_type>(pow(i1, cmplx_f_type(f1, f1)));
check_ret_type<cmplx_d_type>(pow(u1, cmplx_f_type(f1, f1)));
check_ret_type<cmplx_d_type>(pow(l1, cmplx_f_type(f1, f1)));
check_ret_type<cmplx_d_type>(pow(i1, cmplx_d_type(d1, d1)));
- VERIFY( pow(i1, cmplx_d_type(d1, d1)) == pow(d1, cmplx_d_type(d1, d1)) );
- VERIFY( pow(u1, cmplx_d_type(d1, d1)) == pow(d1, cmplx_d_type(d1, d1)) );
- VERIFY( pow(l1, cmplx_d_type(d1, d1)) == pow(d1, cmplx_d_type(d1, d1)) );
+ VERIFY( pow(i1, cmplx_d_type(d1, d1))
+ == pow(double(i1), cmplx_d_type(d1, d1)) );
+ VERIFY( pow(u1, cmplx_d_type(d1, d1))
+ == pow(double(u1), cmplx_d_type(d1, d1)) );
+ VERIFY( pow(l1, cmplx_d_type(d1, d1))
+ == pow(double(l1), cmplx_d_type(d1, d1)) );
check_ret_type<double>(real(i1));
- VERIFY( real(i1) == real(d1) );
- VERIFY( real(i1) == real(cmplx_d_type(d1, d1)) );
+ VERIFY( real(i1) == real(double(i1)) );
+ VERIFY( real(i1) == real(cmplx_d_type(double(i1))) );
}
int main()