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

Fix hangs in binomial sampling #747

Closed
dhardy opened this issue Mar 1, 2019 · 3 comments · Fixed by #752
Closed

Fix hangs in binomial sampling #747

dhardy opened this issue Mar 1, 2019 · 3 comments · Fixed by #752
Labels
X-bug Type: bug report
Milestone

Comments

@dhardy
Copy link
Member

dhardy commented Mar 1, 2019

As noted here it appears that I merged #735 too soon, and it has been causing some tests to hang, though apparently only on MIPS.

@dhardy dhardy added this to the 0.7 release milestone Mar 1, 2019
@dhardy dhardy added the X-bug Type: bug report label Mar 1, 2019
@dhardy
Copy link
Member Author

dhardy commented Mar 7, 2019

Progress report:

  • after an argument with SELinux I am able to run the MIPS test locally
  • putting a limit on the loop for the small-expected-value of 100 iterations, the test succeeds on the native target but hits this limit when run on MIPS

On MIPS, it fails with this output (from just before the loop starts and panicking when x>100):

Sampling from Bin(20, 0.7)
Start: u=0.9136724307867923, r=0.0000459986536544739, a=9.000000000000002, s=0.42857142857142866, q=0.7
thread 'main' panicked at 'Too many tries! u=0.8560244207867922, r=0, x=101', src/distributions/binomial.rs:115:21

Here r is wrong. Is this because of the pow method?

Edit: using let mut r = q.powi(self.n as i32); instead appears to fix the test (no hang), so this would appear to be the case, though the problem does not appear to be with bit logic (using numeric operations instead does not help).

@vks
Copy link
Collaborator

vks commented Mar 7, 2019

Could this be due to different rounding behavior?

@dhardy
Copy link
Member Author

dhardy commented Mar 7, 2019

I don't know. It seems quite a large error, for I think 5 FP ops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
X-bug Type: bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants