Skip to content

Commit

Permalink
Fix bug in PermutedRadicalInverse()
Browse files Browse the repository at this point in the history
Issue #52. Fix suggested by Andrew Kensler.
  • Loading branch information
mmp committed Jan 18, 2016
1 parent b4491d4 commit e118a7a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/montecarlo.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ inline double PermutedRadicalInverse(uint32_t n, uint32_t base,
n *= invBase;
invBi *= invBase;
}
// For the case where the permutation table permutes the digit 0 to
// another digit, account for the infinite sequence of that digit
// trailing at the end of the radical inverse value.
val += p[0] * base / (base-1.0f) * invBi;

This comment has been minimized.

Copy link
@dictoon

dictoon Jan 20, 2016

Note that, if only Faure permutations are used, 0 is always permuted to 0 and this fix is redundant.

return val;
}

Expand Down

0 comments on commit e118a7a

Please sign in to comment.