aherbert commented on a change in pull request #140: Bloomfilter updates2
URL:
https://github.com/apache/commons-collections/pull/140#discussion_r391805516
##########
File path:
src/main/java/org/apache/commons/collections4/bloomfilter/hasher/Shape.java
##########
@@ -43,30 +43,32 @@
* [Wikipedia]</a>
* @since 4.5
*/
-public class Shape {
+public final class Shape {
/**
- * The natural logarithm of 2. Used in several calculations. approx
0.693147180
+ * The natural logarithm of 2. Used in several calculations. Approximately
0.693147180559945.
*/
private static final double LOG_OF_2 = Math.log(2.0);
/**
- * 1 / 2^log(2) approx -0.090619058. Used in calculating the number of
bits.
+ * log(1 / 2^log(2)). Used in calculating the number of bits.
Approximately -0.480453013918201.
Review comment:
I think -0.48 is correct:
[Wikipedia - Bloom Filter - Optimal number of hash
functions](https://en.wikipedia.org/wiki/Bloom_filter#Optimal_number_of_hash_functions)
```
m = - n ln(p) / ln(2)^2
```
So the denominator is -ln(2)^2 = -0.48.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services