1 #ifndef STAN_MATH_PRIM_SCAL_FUN_ISFINITE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_ISFINITE_HPP
3 
4 #include <stan/math/prim/meta.hpp>
5 
6 namespace stan {
7 namespace math {
8 
9 /**
10  * Return true if specified argument is finite (not infinite and not
11  * not-a-number).
12  *
13  * Overloads `std::isfinite` from `<cmath>` for argument-dependent
14  * lookup.
15  *
16  * @tparam ADType type of argument
17  * @param[in] v argument
18  * @return true if argument is finite
19  */
20 template <typename ADType, require_autodiff_t<ADType>* = nullptr>
isfinite(ADType && v)21 inline bool isfinite(ADType&& v) {
22   using std::isfinite;
23   return isfinite(v.val());
24 }
25 
26 }  // namespace math
27 }  // namespace stan
28 
29 #endif
30