From 162409a8d891a12e98eb50d21753e89aff162281 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Tue, 26 May 2009 16:02:12 +0000 Subject: [PATCH] Be more robust: remove tests for equality with zero [[Imported from SVN: r4216]] --- src/rotation.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rotation.hh b/src/rotation.hh index d05572f1..98539759 100644 --- a/src/rotation.hh +++ b/src/rotation.hh @@ -135,7 +135,7 @@ public: for (int m=0; m<3; m++) { - result[m][i] = (norm==0) + result[m][i] = (norm<1e10) /** \todo Isn't there a better way to implement this stably? */ ? 0.5 * (i==m) : 0.5 * std::cos(norm/2) * v[i] * v[m] / (norm*norm) + sincHalf(norm) * ( (i==m) - v[i]*v[m]/(norm*norm)); @@ -152,7 +152,7 @@ public: Dune::array<Dune::FieldMatrix<T,3,3>, 4>& result) { T norm = v.two_norm(); - if (norm==0) { + if (norm<=1e-10) { for (int m=0; m<4; m++) result[m] = 0; -- GitLab