From e6cac85333c9d03421ded5ea356f806521ae58c4 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Tue, 8 Sep 2009 08:27:18 +0200 Subject: Added missing casts. --- test/stable_norm.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'test/stable_norm.cpp') diff --git a/test/stable_norm.cpp b/test/stable_norm.cpp index 0326f7bc9..b8fbf5271 100644 --- a/test/stable_norm.cpp +++ b/test/stable_norm.cpp @@ -36,8 +36,8 @@ template void stable_norm(const MatrixType& m) int rows = m.rows(); int cols = m.cols(); - Scalar big = ei_random() * std::numeric_limits::max() * 1e-4; - Scalar small = 1/big; + Scalar big = ei_random() * std::numeric_limits::max() * RealScalar(1e-4); + Scalar small = static_cast(1)/big; MatrixType vzero = MatrixType::Zero(rows, cols), vrand = MatrixType::Random(rows, cols), @@ -52,19 +52,19 @@ template void stable_norm(const MatrixType& m) VERIFY_IS_APPROX(vrand.blueNorm(), vrand.norm()); VERIFY_IS_APPROX(vrand.hypotNorm(), vrand.norm()); - RealScalar size = m.size(); + RealScalar size = static_cast(m.size()); // test overflow - VERIFY_IS_NOT_APPROX(vbig.norm(), ei_sqrt(size)*big); // here the default norm must fail - VERIFY_IS_APPROX(vbig.stableNorm(), ei_sqrt(size)*big); - VERIFY_IS_APPROX(vbig.blueNorm(), ei_sqrt(size)*big); - VERIFY_IS_APPROX(vbig.hypotNorm(), ei_sqrt(size)*big); + VERIFY_IS_NOT_APPROX(static_cast(vbig.norm()), ei_sqrt(size)*big); // here the default norm must fail + VERIFY_IS_APPROX(static_cast(vbig.stableNorm()), ei_sqrt(size)*big); + VERIFY_IS_APPROX(static_cast(vbig.blueNorm()), ei_sqrt(size)*big); + VERIFY_IS_APPROX(static_cast(vbig.hypotNorm()), ei_sqrt(size)*big); // test underflow - VERIFY_IS_NOT_APPROX(vsmall.norm(), ei_sqrt(size)*small); // here the default norm must fail - VERIFY_IS_APPROX(vsmall.stableNorm(), ei_sqrt(size)*small); - VERIFY_IS_APPROX(vsmall.blueNorm(), ei_sqrt(size)*small); - VERIFY_IS_APPROX(vsmall.hypotNorm(), ei_sqrt(size)*small); + VERIFY_IS_NOT_APPROX(static_cast(vsmall.norm()), ei_sqrt(size)*small); // here the default norm must fail + VERIFY_IS_APPROX(static_cast(vsmall.stableNorm()), ei_sqrt(size)*small); + VERIFY_IS_APPROX(static_cast(vsmall.blueNorm()), ei_sqrt(size)*small); + VERIFY_IS_APPROX(static_cast(vsmall.hypotNorm()), ei_sqrt(size)*small); } void test_stable_norm() @@ -77,4 +77,3 @@ void test_stable_norm() CALL_SUBTEST( stable_norm(VectorXcd(ei_random(10,2000))) ); } } - -- cgit v1.2.3