]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement is_finite
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 15 Mar 2006 20:57:26 +0000 (20:57 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 15 Mar 2006 20:57:26 +0000 (20:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@12605 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/config.cc [new file with mode: 0644]

diff --git a/deal.II/base/source/config.cc b/deal.II/base/source/config.cc
new file mode 100644 (file)
index 0000000..4d8ec7b
--- /dev/null
@@ -0,0 +1,35 @@
+//---------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2006 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+#include <base/config.h>
+#include <cmath>
+#include <limits>
+
+
+namespace deal_II_numbers 
+{
+  bool is_finite (const double x) 
+  {
+#ifdef DEAL_II_HAVE_ISFINITE
+    return std::isfinite (x);
+#else
+                                    // check against infinities. not
+                                    // that if x is a NaN, then both
+                                    // comparisons will be false
+    return ((x >= std::numeric_limits<double>::min())
+           &&
+           (x <= std::numeric_limits<double>::max()));
+#endif
+  }
+}

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.