Inconsistent error handling
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Description
Error handling is not consistent between different mathematical functions. Most primitive functions only call std implementation and return NaN in case of invalid input. Some check for invalid input and throw exceptions.
Example
stan::math::log() directely calls std::log(). So any negative argument results in NaN return value.
stan::math::log1p() checks if its argument is less than -1 and throws std::domain_error if it is.
Expected Output
Consistent error handling.
Current Version:
v3.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the invalid-input behavior of stan::math::log() and stan::math::log1p(), then review the issue discussion for any agreed consistency rule. Done means the mathematical functions follow a clearly defined, consistent error-handling policy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100