summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-15 17:52:36 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-15 17:52:36 +0000
commitd14263e10743080d6415eee2a5d1830f43559c5f (patch)
tree14444be8e89bd889d07d4c47311c867f77a3f47b /libstdc++-v3
parentcf52ad0e3c675531457d4188d419abc1d306e38a (diff)
downloadgcc-d14263e10743080d6415eee2a5d1830f43559c5f.tar.gz
2006-01-15 Paolo Carlini <pcarlini@suse.de>
* testsuite/tr1/8_c_compatibility/complex/overloads_int.cc: Fix norm test, use casts everywhere. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109725 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc52
2 files changed, 34 insertions, 23 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 481e264974c..93b2e0a11f8 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2006-01-15 Paolo Carlini <pcarlini@suse.de>
+
+ * testsuite/tr1/8_c_compatibility/complex/overloads_int.cc:
+ Fix norm test, use casts everywhere.
+
2006-01-14 Paolo Carlini <pcarlini@suse.de>
* testsuite/testsuite_tr1.h: Add missing include; use std::__are_same.
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 c5fcd84cf9d..07b2f924d95 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()