1#ifndef STAN_MATH_PRIM_FUN_TO_INT_HPP
2#define STAN_MATH_PRIM_FUN_TO_INT_HPP
18template <
typename T, require_
integral_t<T>* =
nullptr>
20 return std::forward<T>(x);
41template <
typename T, require_
floating_po
int_t<T>* =
nullptr>
43 static constexpr const char* function =
"to_int";
44 check_bounded(function,
"x", x, std::numeric_limits<int>::min(),
45 std::numeric_limits<int>::max());
46 return static_cast<int>(x);
59 static inline auto fun(
const T& x) {
72template <
typename Container,
74inline auto to_int(
const Container& x) {
require_t< container_type_check_base< is_std_vector, scalar_type_t, TypeCheck, Check... > > require_std_vector_st
Require type satisfies is_std_vector.
void check_bounded(const char *function, const char *name, const T_y &y, const T_low &low, const T_high &high)
Check if the value is between the low and high values, inclusively.
T to_int(T x)
Returns the input scalar as an integer type.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Return elementwise integer value of the specified real-valued container.