add `cospi()`, `sinpi()`, `tanpi()`
Open
Nobody has claimed this yet.
good first issue
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Stan math contains numerically stable versions of functions in error prone areas such as log1p, I suggest wrapping Boost's implementations of cospi(), sinpi(), tanpi(). These are useful when the input is a multiple of 0.5.
For example,
> stanFunction("cos", x = c(pi * 0.5, pi * 1.5)) # compiles and returns non-zero values
[1] 6.123234e-17 -1.836970e-16
> cospi(c(0.5, 1.5))
[1] 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 locating Stan Math's existing numerically stable wrappers, such as log1p, and the entry points used to wrap Boost implementations. Add cospi(), sinpi(), and tanpi() with behavior that is exact or stable for inputs that are multiples of 0.5, then verify results like cospi(0.5) and cospi(1.5) against the examples in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100