Use numext::abs instead of std::abs in scalar_fuzzy_default_impl to make it usable inside GPU kernels.

This commit is contained in:
Benoit Steiner 2016-04-08 19:40:48 -07:00
parent 01bd577288
commit 5da90fc8dd

View File

@ -1128,14 +1128,12 @@ struct scalar_fuzzy_default_impl<Scalar, false, false>
template<typename OtherScalar> EIGEN_DEVICE_FUNC
static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec)
{
EIGEN_USING_STD_MATH(abs);
return abs(x) <= abs(y) * prec;
return numext::abs(x) <= numext::abs(y) * prec;
}
EIGEN_DEVICE_FUNC
static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec)
{
EIGEN_USING_STD_MATH(abs);
return abs(x - y) <= numext::mini(abs(x), abs(y)) * prec;
return numext::abs(x - y) <= numext::mini(numext::abs(x), numext::abs(y)) * prec;
}
EIGEN_DEVICE_FUNC
static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec)