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

Minor mistake in code sample #7

Open
GaryHuan9 opened this issue Apr 13, 2022 · 0 comments
Open

Minor mistake in code sample #7

GaryHuan9 opened this issue Apr 13, 2022 · 0 comments

Comments

@GaryHuan9
Copy link

In section 16.4.2.3 Hierarchical Transformation (p233), the first code sample is missing a curly braces between line 8 and 9 to close off the else statement:

 1 node = root;
 2 while (!node.isLeaf) {
 3     if (u < node.probLeft) {
 4         u /= node.probLeft;
 5         node = node.left;
 6     } else {
 7         u /= (1.0 - node.probLeft);
 8         node = node.right;
 9 }
10 // Ok. We have found a leaf with the correct probability!

Should be:

 1 node = root;
 2 while (!node.isLeaf) {
 3     if (u < node.probLeft) {
 4         u /= node.probLeft;
 5         node = node.left;
 6     } else {
 7         u /= (1.0 - node.probLeft);
 8         node = node.right;
 9     }                                 <<<<<<<<<<<<<<<<<<<<< Missing this
10 }
11 // Ok. We have found a leaf with the correct probability!
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

No branches or pull requests

1 participant