From 134d9f19ab5dbe5262c158090c95cb77aeaf9959 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 15 Mar 2006 20:57:26 +0000 Subject: [PATCH] Implement is_finite git-svn-id: https://svn.dealii.org/trunk@12605 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/config.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 deal.II/base/source/config.cc diff --git a/deal.II/base/source/config.cc b/deal.II/base/source/config.cc new file mode 100644 index 0000000000..4d8ec7b70e --- /dev/null +++ b/deal.II/base/source/config.cc @@ -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 +#include +#include + + +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::min()) + && + (x <= std::numeric_limits::max())); +#endif + } +} -- 2.39.5