mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-16 21:55:58 +08:00
Incorporate C++11 check into EIGEN_HAS_C99_MATH macro
This commit is contained in:
parent
0250f4a9f2
commit
249c48ba00
@ -804,26 +804,18 @@ bool (isfinite)(const std::complex<T>& x)
|
|||||||
using std::imag;
|
using std::imag;
|
||||||
return isfinite(real(x)) && isfinite(imag(x));
|
return isfinite(real(x)) && isfinite(imag(x));
|
||||||
}
|
}
|
||||||
#import <iostream>
|
|
||||||
// Let's be conservative and enable the std::isnan implementation only if we are sure it exists
|
template<typename T>
|
||||||
#if (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
|
EIGEN_DEVICE_FUNC
|
||||||
&& (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC) \
|
bool (isNaN)(const T& x)
|
||||||
|| defined(EIGEN_HAS_C99_MATH)
|
{
|
||||||
template<typename T>
|
#ifdef EIGEN_HAS_C99_MATH
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
bool (isNaN)(const T& x)
|
|
||||||
{
|
|
||||||
using std::isnan;
|
using std::isnan;
|
||||||
return isnan(x);
|
return isnan(x);
|
||||||
}
|
#else
|
||||||
#else
|
return x != x;
|
||||||
template<typename T>
|
#endif
|
||||||
EIGEN_DEVICE_FUNC
|
}
|
||||||
bool (isNaN)(const T& x)
|
|
||||||
{
|
|
||||||
return x == x;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
@ -835,25 +827,17 @@ bool (isNaN)(const std::complex<T>& x)
|
|||||||
return isnan(real(x)) || isnan(imag(x));
|
return isnan(real(x)) || isnan(imag(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's be conservative and enable the std::isinf implementation only if we are sure it exists
|
template<typename T>
|
||||||
#if (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
|
EIGEN_DEVICE_FUNC
|
||||||
&& (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC) \
|
bool (isInf)(const T& x)
|
||||||
|| defined(EIGEN_HAS_C99_MATH)
|
{
|
||||||
template<typename T>
|
#ifdef EIGEN_HAS_C99_MATH
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
bool (isInf)(const T& x)
|
|
||||||
{
|
|
||||||
using std::isinf;
|
using std::isinf;
|
||||||
return isinf(x);
|
return isinf(x);
|
||||||
}
|
#else
|
||||||
#else
|
|
||||||
template<typename T>
|
|
||||||
EIGEN_DEVICE_FUNC
|
|
||||||
bool (isInf)(const T& x)
|
|
||||||
{
|
|
||||||
return x>NumTraits<T>::highest() || x<NumTraits<T>::lowest();
|
return x>NumTraits<T>::highest() || x<NumTraits<T>::lowest();
|
||||||
}
|
#endif
|
||||||
#endif
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
|
@ -403,10 +403,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Does the compiler support C99 math?
|
// Does the compiler support C99 math?
|
||||||
#if (EIGEN_COMP_GNUC_STRICT || \
|
#if (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \
|
||||||
(EIGEN_COMP_ICC && EIGEN_COMP_GNUC) || \
|
&& (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC) || \
|
||||||
(EIGEN_COMP_CLANG) || \
|
(EIGEN_COMP_GNUC_STRICT || \
|
||||||
(EIGEN_COMP_MSVC >= 1800))
|
(EIGEN_COMP_ICC && EIGEN_COMP_GNUC) || \
|
||||||
|
(EIGEN_COMP_CLANG) || \
|
||||||
|
(EIGEN_COMP_MSVC >= 1800))
|
||||||
#define EIGEN_HAS_C99_MATH 1
|
#define EIGEN_HAS_C99_MATH 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user