diff --git a/packages/kokkos-kernels/src/Kokkos_ArithTraits.hpp b/packages/kokkos-kernels/src/Kokkos_ArithTraits.hpp index 979fccb3c843..e87833533444 100644 --- a/packages/kokkos-kernels/src/Kokkos_ArithTraits.hpp +++ b/packages/kokkos-kernels/src/Kokkos_ArithTraits.hpp @@ -57,7 +57,6 @@ #include #include #include -#include // strtof, strtod, strtold #include // std::complex #include // std::numeric_limits #ifdef __CUDACC__ @@ -645,10 +644,8 @@ class ArithTraits { static KOKKOS_FORCEINLINE_FUNCTION float nan () { #ifdef __CUDA_ARCH__ return CUDART_NAN_F; - //return nan (); //this returns 0??? #else - // http://pubs.opengroup.org/onlinepubs/009696899/functions/nan.html - return strtof ("NAN()", (char**) NULL); + return std::numeric_limits::quiet_NaN(); #endif // __CUDA_ARCH__ } static KOKKOS_FORCEINLINE_FUNCTION mag_type eps () { @@ -886,10 +883,8 @@ class ArithTraits { static KOKKOS_FORCEINLINE_FUNCTION val_type nan () { #ifdef __CUDA_ARCH__ return CUDART_NAN; - //return nan (); // this returns 0 ??? #else - // http://pubs.opengroup.org/onlinepubs/009696899/functions/nan.html - return strtod ("NAN", (char**) NULL); + return std::numeric_limits::quiet_NaN(); #endif // __CUDA_ARCH__ } static KOKKOS_FORCEINLINE_FUNCTION mag_type epsilon () { @@ -1020,7 +1015,7 @@ class ArithTraits { return ::log10 (x); } static val_type nan () { - return strtold ("NAN()", (char**) NULL); + return std::numeric_limits::quiet_NaN(); } static mag_type epsilon () { return LDBL_EPSILON;