diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-10-28 16:49:15 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-10-28 16:49:15 +0100 |
commit | 6759a21e49614dd7cd977e3c1fd782458f33fc9f (patch) | |
tree | 6b6513d8b65ab4f88cfd91031ebad68bb77df57a /Eigen/src/Core/util/Meta.h | |
parent | 28ddb5158dbe2a633a11f77ad7145ceae08abbf3 (diff) |
CUDA support: define more accurate min/max values for device::numeric_limits of float and double using values from cfloat header
Diffstat (limited to 'Eigen/src/Core/util/Meta.h')
-rw-r--r-- | Eigen/src/Core/util/Meta.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 6eb409194..ef35cefb4 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -11,6 +11,10 @@ #ifndef EIGEN_META_H #define EIGEN_META_H +#if defined(__CUDA_ARCH__) +#include <cfloat> +#endif + namespace Eigen { namespace internal { @@ -138,16 +142,16 @@ template<> struct numeric_limits<float> EIGEN_DEVICE_FUNC static float (max)() { return CUDART_MAX_NORMAL_F; } EIGEN_DEVICE_FUNC - static float (min)() { return __FLT_EPSILON__; } + static float (min)() { return FLT_MIN; } }; template<> struct numeric_limits<double> { EIGEN_DEVICE_FUNC static double epsilon() { return __DBL_EPSILON__; } EIGEN_DEVICE_FUNC - static double (max)() { return CUDART_INF; } + static double (max)() { return DBL_MAX; } EIGEN_DEVICE_FUNC - static double (min)() { return __DBL_EPSILON__; } + static double (min)() { return DBL_MIN; } }; template<> struct numeric_limits<int> { |