Skip to content
Snippets Groups Projects
Commit 162409a8 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

Be more robust: remove tests for equality with zero

[[Imported from SVN: r4216]]
parent 29d925d0
No related branches found
No related tags found
No related merge requests found
...@@ -135,7 +135,7 @@ public: ...@@ -135,7 +135,7 @@ public:
for (int m=0; m<3; m++) { 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? */ /** \todo Isn't there a better way to implement this stably? */
? 0.5 * (i==m) ? 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)); : 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: ...@@ -152,7 +152,7 @@ public:
Dune::array<Dune::FieldMatrix<T,3,3>, 4>& result) { Dune::array<Dune::FieldMatrix<T,3,3>, 4>& result) {
T norm = v.two_norm(); T norm = v.two_norm();
if (norm==0) { if (norm<=1e-10) {
for (int m=0; m<4; m++) for (int m=0; m<4; m++)
result[m] = 0; result[m] = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment