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 376 phi tails #430

Merged
merged 9 commits into from
Dec 5, 2013
Merged

Bugfix/issue 376 phi tails #430

merged 9 commits into from
Dec 5, 2013

Conversation

bob-carpenter
Copy link
Contributor

Summary

Fix #376 by expanding domain of stan::math::Phi as far as is possible (on the non-log scale) using double precision floating point.

Intended Effect

  • explicitly underflow to 0 for inputs less than -37.5 without calling erfc()
  • use erfc() instead of erf() for negative args below -5,
  • explicitly overflow to 0 for inputs greater than 8.25 without calling erf()
  • use erfc() otherwise

No change on derivative behavior.

Example

Phi(-35) no longer underflows. See the unit tests for a complete test of the defined range and the agrad tests for tests of the derivative range.

Side Effects

None.

Documentation

Added doc for underflow behavior of Phi and its derivatives to the manual.

Reviewer Suggestions

Anyone.

Does anyone know if there's a better way to test extreme values than EXPECT_FLOAT_EQ(1, expected / found) ?

@stan-buildbot
Copy link
Contributor

Test FAILed.
Refer to this link for build results: http://d1m1s1b1.stat.columbia.edu:8080/job/Stan%20Github%20Pull%20Requests/303/

@syclik
Copy link
Member

syclik commented Dec 5, 2013

Jenkins, retest this please.

@stan-buildbot
Copy link
Contributor

Test PASSed.
Refer to this link for build results: http://d1m1s1b1.stat.columbia.edu:8080/job/Stan%20Github%20Pull%20Requests/305/

@syclik
Copy link
Member

syclik commented Dec 5, 2013

Review

Looks good to merge. All tests pass. Thanks for adding tests at the boundaries.

syclik added a commit that referenced this pull request Dec 5, 2013
@syclik syclik merged commit 16046b8 into develop Dec 5, 2013
@syclik syclik deleted the bugfix/issue-376-Phi-tails branch December 7, 2013 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug in Phi(x) for x < -8.5 or so
3 participants