From b251f41e5b6d1302d463fce23e54a503d58ab4a7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 29 Jun 2015 17:59:54 -0500 Subject: [PATCH] Verify that a number is not a NaN before testing for finiteness. While not intuitive, std::isfinite triggers a floating point exception when called on a signalling NaN. Avoid this. --- source/base/config.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/base/config.cc b/source/base/config.cc index a1514c74a0..82e0155759 100644 --- a/source/base/config.cc +++ b/source/base/config.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2006 - 2014 by the deal.II authors +// Copyright (C) 2006 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -25,7 +25,7 @@ namespace numbers bool is_finite (const double x) { #ifdef DEAL_II_HAVE_ISFINITE - return std::isfinite (x); + return !isnan(x) && std::isfinite (x); #else // Check against infinities. Note // that if x is a NaN, then both -- 2.39.5