diff --git a/cmake/SundialsSetupCompilers.cmake b/cmake/SundialsSetupCompilers.cmake index f0e109932d..1d2873b6e7 100644 --- a/cmake/SundialsSetupCompilers.cmake +++ b/cmake/SundialsSetupCompilers.cmake @@ -120,20 +120,6 @@ set(DOCSTR "Enable C compiler specific extensions") sundials_option(CMAKE_C_EXTENSIONS BOOL "${DOCSTR}" ON) message(STATUS "C extensions set to ${CMAKE_C_EXTENSIONS}") -# --------------------------------------------------------------- -# Check for isinf and isnan -# --------------------------------------------------------------- - -check_c_source_compiles(" - #include - int main(void) { - double a = 0.0; - int result = isinf(a); - result = isnan(a); - return result; - } -" SUNDIALS_C_COMPILER_HAS_ISINF_ISNAN) - # --------------------------------------------------------------- # Check for __builtin_expect # --------------------------------------------------------------- diff --git a/examples/sunlinsol/test_sunlinsol.c b/examples/sunlinsol/test_sunlinsol.c index 46463afc4d..2a6900e666 100644 --- a/examples/sunlinsol/test_sunlinsol.c +++ b/examples/sunlinsol/test_sunlinsol.c @@ -20,7 +20,7 @@ #include "test_sunlinsol.h" -#include /* include isnan */ +#include #include #include #include diff --git a/examples/sunmatrix/test_sunmatrix.c b/examples/sunmatrix/test_sunmatrix.c index d9c9fb754a..f6041c1983 100644 --- a/examples/sunmatrix/test_sunmatrix.c +++ b/examples/sunmatrix/test_sunmatrix.c @@ -20,7 +20,7 @@ #include "test_sunmatrix.h" -#include /* include isnan */ +#include #include #include #include diff --git a/include/sundials/sundials_config.in b/include/sundials/sundials_config.in index db3a6268d6..25d2fe8e78 100644 --- a/include/sundials/sundials_config.in +++ b/include/sundials/sundials_config.in @@ -56,7 +56,6 @@ * SUNDIALS build information * -----------------------------------------------------------------*/ -#cmakedefine SUNDIALS_C_COMPILER_HAS_ISINF_ISNAN #cmakedefine SUNDIALS_C_COMPILER_HAS_BUILTIN_EXPECT #cmakedefine SUNDIALS_C_COMPILER_HAS_ATTRIBUTE_ASSUME #cmakedefine SUNDIALS_C_COMPILER_HAS_BUILTIN_ASSUME diff --git a/src/sundials/sundials_math.c b/src/sundials/sundials_math.c index dfd4aaf6a4..b60e9c2540 100644 --- a/src/sundials/sundials_math.c +++ b/src/sundials/sundials_math.c @@ -22,28 +22,6 @@ #include #include -static sunbooleantype sunIsInf(sunrealtype a) -{ -#if defined(__cplusplus) || defined(SUNDIALS_C_COMPILER_HAS_ISINF_ISNAN) - return (isinf(a)); -#else - return (a < -SUN_BIG_REAL || a > SUN_BIG_REAL); -#endif -} - -static sunbooleantype sunIsNaN(sunrealtype a) -{ -#if defined(__cplusplus) || defined(SUNDIALS_C_COMPILER_HAS_ISINF_ISNAN) - return (isnan(a)); -#else - /* Most compilers/platforms follow NaN != a, - * but since C89 does not require this, it is - * possible some platforms might not follow it. - */ - return (a != a); -#endif -} - sunrealtype SUNRpowerI(sunrealtype base, int exponent) { int i, expt; @@ -88,10 +66,10 @@ sunbooleantype SUNRCompareTol(sunrealtype a, sunrealtype b, sunrealtype tol) if (a == b) { return (SUNFALSE); } /* If a or b are NaN */ - if (sunIsNaN(a) || sunIsNaN(b)) { return (SUNTRUE); } + if (isnan(a) || isnan(b)) { return (SUNTRUE); } /* If one of a or b are Inf (since we handled both being inf above) */ - if (sunIsInf(a) || sunIsInf(b)) { return (SUNTRUE); } + if (isinf(a) || isinf(b)) { return (SUNTRUE); } diff = SUNRabs(a - b); norm = SUNMIN(SUNRabs(a + b), SUN_BIG_REAL);