Stan Math Library
5.0.0
Automatic Differentiation
|
|
inline |
Returns the input scalar as an integer type.
This function performs no rounding and simply truncates the decimal to return only the signficand as an integer.
Casting NaN and Inf values to integers is considered undefined behavior as NaN and Inf cannot be represented as an integer and most implementations simply overflow, as such this function throws for these inputs.
The function also throws for floating-point values that are too large to be represented as an integer.
T | type of argument (must be arithmetic) |
x | argument |
std::domain_error | for NaN, Inf, or floating point values not in range to be represented as int |
Definition at line 42 of file to_int.hpp.