Description
Functions such as binomial_lpmf never check that their size (N) and number of success (n) parameters have integer value types. This also applies to hypergeometric_lpmf and others.
As written, they'll merrily accept real values and return nonsensical results.
In the past, we've just assumed nobody would call them with real values because we define the acceptable signatures in the Stan language.
It would be better to enforce integer base value types for these arguments. This can be done with something like the following template parameter to ensure all of T1, T2, and T3 have integer value types:
typename = std::enable_if_t<std::is_integral<scalar_type_t<T1>>::value
&& std::is_integral<scalar_type_t<T2>>::value
&& std::is_integral<scalar_type_t<T3>>::value>
The doc also needs to indicate this won't work. I don't know a good way to test that integer instantiations don't compile.
Current Version:
v3.1.0
Description
Functions such as
binomial_lpmfnever check that their size (N) and number of success (n) parameters have integer value types. This also applies tohypergeometric_lpmfand others.As written, they'll merrily accept real values and return nonsensical results.
In the past, we've just assumed nobody would call them with real values because we define the acceptable signatures in the Stan language.
It would be better to enforce integer base value types for these arguments. This can be done with something like the following template parameter to ensure all of
T1,T2, andT3have integer value types:The doc also needs to indicate this won't work. I don't know a good way to test that integer instantiations don't compile.
Current Version:
v3.1.0