stan-dev / stan-dev/math

domain errors not being thrown by uniform_lpdf, discrete_uniform_lpmf, pareto_lpdf

Open
#1,697 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug code cleanup
Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

The uniform_lpdf, discrete_uniform_lpmf and pareto_lpdf all have support determined by parameters. When the variate is not in that support we should be throwing std::domain_error as elsewhere.

The principle at work here is that we want to fail fast with an informative error message, not just let NaN values propagate and cause rejections.

Current Version:

v3.1.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementations of uniform_lpdf, discrete_uniform_lpmf, and pareto_lpdf, then inspect comparable distributions that already throw std::domain_error for out-of-support variates. Done means each named function fails fast with an informative domain error instead of allowing NaN values to propagate, with matching tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.