]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Cast long doubles to doubles, since that is necessary with DEC's cxx compiler as...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 26 Sep 2001 07:01:53 +0000 (07:01 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 26 Sep 2001 07:01:53 +0000 (07:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@5063 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-10/step-10.cc

index 6070e89f6154d4802329ad5f4edf18753aef448d..5a03cabb6a94140c3ca01aa376c1f9daaf7e7d93 100644 (file)
@@ -475,9 +475,20 @@ void compute_pi_by_area ()
                                           // cast to double as there
                                           // is no add_value(string,
                                           // long double) function
-                                          // implemented.
+                                          // implemented. Note that
+                                          // this also concerns the
+                                          // second call as the ``fabs''
+                                          // function in the ``std''
+                                          // namespace is overloaded on
+                                          // its argument types, so there
+                                          // exists a version taking
+                                          // and returning a ``long double'',
+                                          // in contrast to the global
+                                          // namespace where only one such
+                                          // function is declared (which
+                                          // takes and returns a double).
          table.add_value("eval.pi", static_cast<double> (area));
-         table.add_value("error", std::fabs(area-pi));
+         table.add_value("error",   static_cast<double> (std::fabs(area-pi)));
        };
 
                                       // We want to compute
@@ -594,7 +605,7 @@ void compute_pi_by_perimeter ()
                                           // Then store the evaluated
                                           // values in the table...
          table.add_value("eval.pi", static_cast<double> (perimeter/2.));
-         table.add_value("error", std::fabs(perimeter/2.-pi));
+         table.add_value("error",   static_cast<double> (std::fabs(perimeter/2.-pi)));
        };
 
                                       // ...and end this function as

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.