1 #ifndef STAN_MATH_PRIM_FUN_IS_INTEGER_HPP 2 #define STAN_MATH_PRIM_FUN_IS_INTEGER_HPP 3 4 #include <stan/math/prim/meta.hpp> 5 #include <stan/math/prim/fun/floor.hpp> 6 #include <cmath> 7 8 namespace stan { 9 namespace math { 10 11 /** 12 * Returns true if the input is an integer and false otherwise. 13 * 14 * @param x Value to test. 15 * @return <code>true</code> if the value is an integer 16 */ 17 template <typename T> is_integer(T x)18inline bool is_integer(T x) { 19 using std::floor; 20 return floor(x) == x; 21 } 22 23 } // namespace math 24 } // namespace stan 25 26 #endif 27