Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/issue 1179 exponential lower bound check #1469

Merged
merged 8 commits into from
Jun 5, 2015
2 changes: 1 addition & 1 deletion src/stan/math/prim/scal/prob/exponential_log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace stan {
using std::log;

T_partials_return logp(0.0);
check_not_nan(function, "Random variable", y);
check_nonnegative(function, "Random variable", y);
check_positive_finite(function, "Inverse scale parameter", beta);
check_consistent_sizes(function,
"Random variable", y,
Expand Down
10 changes: 10 additions & 0 deletions src/test/prob/exponential/exponential_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ class AgradDistributionsExponential : public AgradDistributionTest {
param[1] = 3.9; // beta
parameters.push_back(param);
log_prob.push_back(-57.13902344686439249699); // expected log_prob

param[0] = 1e-08;
param[1] = 3.9;
parameters.push_back(param);
log_prob.push_back(1.3609765141356007);
}

void invalid_values(vector<size_t>& index,
vector<double>& value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test on the boundary where y = 0.

// y
index.push_back(0U);
value.push_back(-10.0);

index.push_back(0U);
value.push_back(numeric_limits<double>::quiet_NaN());

// beta
index.push_back(1U);
Expand Down