Skip to content

Conversation

lgarrison
Copy link
Owner

From #1, Box-Muller was using uniform floats in the half-open interval [0,1), which would cause it to generate an inf if it encountered 0 exactly. We now instead generate uniform floats in (0,1] (just for BM; uniform randoms are unchanged). This will cause the standard_normal results to change in the last few digits from what they were before.

The Box-Muller Wikipedia article says the uniform floats should be in the open interval (0,1), but this is hard to do without rejection sampling... if we are making an error, it's at most O(2^-24) for floats and less for doubles.

@lgarrison lgarrison merged commit 5295350 into main Dec 19, 2021
@lgarrison lgarrison deleted the fix-normal-inf branch December 19, 2021 00:23
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.

1 participant