Closed benmwebb closed 2 years ago
I think the function below returns true when x is Nan and it should be false.
template <class Base> bool isfinite(const CppAD::AD<Base> &x)
{ return !isinf(x); }
I think this should work properly:
template <class Base> bool isfinite(const CppAD::AD<Base> &x)
{ return isfinite(CppAD::Value( CppAD::Var2Par(x) ) ); }
I think the function below returns true when x is Nan and it should be false.
template <class Base> bool isfinite(const CppAD::AD<Base> &x)
{ return !isinf(x); }
I think this should work properly:
template <class Base> bool isfinite(const CppAD::AD<Base> &x)
{ return isfinite(CppAD::Value( CppAD::Var2Par(x) ) ); }
I think the function below returns true when x is Nan and it should be false.
You're right of course; your fix works for my example and I'll update the PR.
When using Eigen 3.4 it may attempt to call std::isfinite() on AD objects (see isfinite_impl() in Eigen/src/Core/MathFunctions.h). Provide a suitable specialization, similar to those provided for std::isinf and std::isnan in PR #140.