Skip to content

It's doesn't work with bigint #43

@fsdevblog

Description

@fsdevblog

I need to push to store around 300 millions of records
I have to use BloomFilter::Native, because Redis string has limit 512Mb.

My calculations:

count_elements = 300_000_000
false_positive = 1.0E-6

m = BigDecimal(((count_elements * Math.log(false_positives)) / Math.log(1.0 / 2 ** Math.log(2))).to_s) # => 8626552539
k = (Math.log(2.0) * m / count_elements).ceil # => 20

But, it's doesn't work with bigint

Exception `RangeError' at /home/fsdev/.rvm/gems/ruby-2.4.1@test/gems/bloomfilter-rb-2.1.1/lib/bloomfilter/native.rb:20 - integer 8626552539 too big to convert to `int'
/home/fsdev/.rvm/gems/ruby-2.4.1@test/gems/bloomfilter-rb-2.1.1/lib/bloomfilter/native.rb:20:in `new': integer 8626552539 too big to convert to `int' (RangeError)
        from /home/fsdev/rvm/gems/ruby-2.4.1@test/gems/bloomfilter-rb-2.1.1/lib/bloomfilter/native.rb:20:in `initialize'

:(((
Илья, выручай :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions