Fix compilation errors with isnan/isinf using Cygwin's GCC

Cherry-pick of trunk r2737.
This commit is contained in:
Ray Speth 2014-02-24 03:27:21 +00:00
parent f3b877d0a1
commit 5441577624

View file

@ -32,7 +32,7 @@ namespace Cantera {
void checkFinite(const double tmp)
{
#ifdef _WIN32
#if defined _WIN32
if (_finite(tmp)) {
if (_isnan(tmp)) {
printf("checkFinite() ERROR: we have encountered a nan!\n");
@ -43,6 +43,17 @@ void checkFinite(const double tmp)
}
throw std::range_error("checkFinite()");
}
#elif defined __CYGWIN__
if (!finite(tmp)) {
if (isnan(tmp)) {
printf("checkFinite() ERROR: we have encountered a nan!\n");
} else if (isinf(tmp) == 1) {
printf("checkFinite() ERROR: we have encountered a pos inf!\n");
} else {
printf("checkFinite() ERROR: we have encountered a neg inf!\n");
}
throw std::range_error("checkFinite()");
}
#else
if (!::finite(tmp)) {
if (::isnan(tmp)) {