You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Claude Warren (Jira)" <ji...@apache.org> on 2022/06/11 12:19:00 UTC

[jira] [Created] (COLLECTIONS-817) BloomFilter: Converting Double to Int

Claude Warren created COLLECTIONS-817:
-----------------------------------------

             Summary: BloomFilter: Converting Double to Int
                 Key: COLLECTIONS-817
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-817
             Project: Commons Collections
          Issue Type: Bug
          Components: Collection
            Reporter: Claude Warren
             Fix For: 4.5


[https://github.com/Claudenw/commons-collections/blob/9f2945cc98747893456b73f42ab53f46a866ac37/src/main/java/org/apache/commons/collections4/bloomfilter/BloomFilter.java#L216-L251]

Should this be a double?

Since this is a pass through method that is converting a precise value from the shape into an imprecise one I would recommend removing it. A paragraph can be added to the class javadoc on how to estimate N and also the size of the union and intersection with another filter. Those methods also suffer from the same inaccuracy. If this functionality was moved to class javadoc then it is clear to the user how to compute it and what the computation requires.

Another issue is that the argument filter's shape is not checked. The merge should join the smaller filter into the bigger one and then the estimateN called on the larger filter. Otherwise this method is not symmetric. One way would be fine but the other would result in a merge error.

If this is only intended for filters with the same number of bits then the expected result of a mismatch is not documented.

 



--
This message was sent by Atlassian Jira
(v8.20.7#820007)