]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix MappingQ1 1846/head
authorRene Gassmoeller <R.Gassmoeller@mailbox.org>
Sun, 8 Nov 2015 06:06:47 +0000 (00:06 -0600)
committerRene Gassmoeller <R.Gassmoeller@mailbox.org>
Sun, 8 Nov 2015 06:06:47 +0000 (00:06 -0600)
source/fe/mapping_q_generic.cc

index 9f5eec7b3d89dcd1dcc1826ad48e1948cc128e95..4696483c380c04027b5cdf37ac0636f58475c39e 100644 (file)
@@ -106,8 +106,10 @@ namespace internal
             eta1 = -c/b;
             eta2 = -c/b;
           }
-        // special case #2: if c is very small:
-        else if (std::abs(c/b) < 1e-12)
+        // special case #2: if c is very small or the square root of the
+        // discriminant is nearly b.
+        else if (std::abs(c) < 1e-12*std::abs(b)
+                 || std::abs(std::sqrt(discriminant) - b) <= 1e-14*std::abs(b))
           {
             eta1 = (-b - std::sqrt(discriminant)) / (2*a);
             eta2 = (-b + std::sqrt(discriminant)) / (2*a);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.