From: Wolfgang Bangerth Date: Mon, 29 Jun 2015 22:59:54 +0000 (-0500) Subject: Verify that a number is not a NaN before testing for finiteness. X-Git-Tag: v8.3.0-rc1~73^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b251f41e5b6d1302d463fce23e54a503d58ab4a7;p=dealii.git 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. --- 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