-
Notifications
You must be signed in to change notification settings - Fork 409
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
Fix rand
for truncated normal with 0 variance
#1721
base: master
Are you sure you want to change the base?
Conversation
Fixes issue 1712.
if a <= μ <= b | ||
z = 0.0 | ||
else | ||
return NaN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we would want to catch this case earlier in truncated
: A distribution with zero mass is by definition not a distribution. See #843.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's throw an error here? I don't think returning NaN
is particularly useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened #1723 as a means of catching this case earlier, but I'd also be fine throwing an error here.
Seems I was beaten to the punch by about 2 years: #1273 🙂 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1721 +/- ##
==========================================
+ Coverage 85.75% 85.87% +0.11%
==========================================
Files 138 138
Lines 8339 8344 +5
==========================================
+ Hits 7151 7165 +14
+ Misses 1188 1179 -9
☔ View full report in Codecov by Sentry. |
Fixes #1712.