File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,17 @@ prop_calc_size_fpr_fpr proxy (FPR fpr) (NumEntries numEntries) =
156
156
(fromIntegral (B. sizeHashes bsize))
157
157
~~~ fpr
158
158
where
159
- (~~~) = withinTolerance 1e-6
159
+ (~~~) = withinTolerance tolerance
160
+ -- At small filter sizes (corresponding to high FPRs), we get significant
161
+ -- reductions in accuracy due to rounding the number of bits to an integer.
162
+ -- So we use greater tolerances for bigger FPRs.
163
+ -- Contrast with prop_calc_policy_fpr which does not do rounding to an
164
+ -- integer number of bits (it uses Double for bits per key), and thus can
165
+ -- use a very small tolerance.
166
+ tolerance | fpr <= 0.01 = 1e-6
167
+ | fpr <= 0.05 = 1e-5
168
+ | fpr <= 0.5 = 1e-4
169
+ | otherwise = 1e-3
160
170
161
171
-- | Compare @sizeForBits@ against @falsePositiveRate@ with some tolerance for deviations
162
172
prop_calc_size_fpr_bits :: BloomFilter bloom => Proxy bloom
You can’t perform that action at this time.
0 commit comments