diff --git a/test/geo_hyperplane.cpp b/test/geo_hyperplane.cpp index 2e6b5006c..bf0a18174 100644 --- a/test/geo_hyperplane.cpp +++ b/test/geo_hyperplane.cpp @@ -96,9 +96,9 @@ void lines() { Vector u = Vector::Random(); Vector v = Vector::Random(); Scalar a = internal::random(); - while (abs(a - 1) < Scalar(1e-4)) a = internal::random(); - while (u.norm() < Scalar(1e-4)) u = Vector::Random(); - while (v.norm() < Scalar(1e-4)) v = Vector::Random(); + if (abs(a - 1) < Scalar(1e-4)) a = Scalar(0); + if (u.norm() < Scalar(1e-4)) u = Vector::Unit(0); + if (v.norm() < Scalar(1e-4)) v = Vector::Unit(1); HLine line_u = HLine::Through(center + u, center + a * u); HLine line_v = HLine::Through(center + v, center + a * v); diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index 99ec9a5fb..68120d9d3 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -162,9 +162,8 @@ void transformations() { // Transform // TODO complete the tests ! - a = 0; - while (abs(a) < Scalar(0.1)) - a = internal::random(-Scalar(0.4) * Scalar(EIGEN_PI), Scalar(0.4) * Scalar(EIGEN_PI)); + a = internal::random(-Scalar(0.4) * Scalar(EIGEN_PI), Scalar(0.4) * Scalar(EIGEN_PI)); + if (abs(a) < Scalar(0.1)) a = Scalar(0.1); q1 = AngleAxisx(a, v0.normalized()); Transform3 t0, t1, t2; diff --git a/test/mixingtypes.cpp b/test/mixingtypes.cpp index 8f0fff3b7..78032b5fc 100644 --- a/test/mixingtypes.cpp +++ b/test/mixingtypes.cpp @@ -77,10 +77,10 @@ void mixingtypes(int size = SizeAtCompileType) { float epsf = std::sqrt(std::numeric_limits::min EIGEN_EMPTY()); double epsd = std::sqrt(std::numeric_limits::min EIGEN_EMPTY()); - while (std::abs(sf) < epsf) sf = internal::random(); - while (std::abs(sd) < epsd) sd = internal::random(); - while (std::abs(scf) < epsf) scf = internal::random(); - while (std::abs(scd) < epsd) scd = internal::random(); + if (std::abs(sf) < epsf) sf = 1.0f; + if (std::abs(sd) < epsd) sd = 1.0; + if (std::abs(scf) < epsf) scf = CF(1); + if (std::abs(scd) < epsd) scd = CD(1); // check scalar products VERIFY_MIX_SCALAR(vcf * sf, vcf * complex(sf)); diff --git a/test/triangular.cpp b/test/triangular.cpp index 62bb7742c..1a3fbcbc1 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -86,7 +86,7 @@ void triangular_square(const MatrixType& m) { m1 = MatrixType::Random(rows, cols); for (int i = 0; i < rows; ++i) - while (numext::abs2(m1(i, i)) < RealScalar(1e-1)) m1(i, i) = internal::random(); + if (numext::abs2(m1(i, i)) < RealScalar(1e-1)) m1(i, i) = Scalar(1); Transpose trm4(m4); // test back and forward substitution with a vector as the rhs