Open
Description
It seems that Go's behavior when casting Positive Infinity to uint32 is architecture specific. This causes theApproximatedSize
calculation to return an inconsistent value between architectures.
If you run this:
saturatedBloom := bloom.FromWithM(bitset.New(10000).Complement().Bytes(), 10000, 4)
fmt.Println(saturatedBloom.ApproximatedSize())
In amd64, it prints 0
, while if you run it on arm64, it prints the max value for uint32
.
For a smaller example:
fmt.Println(uint32(math.Inf(1)))
Is equivalent.
I'd expect a saturated bloom to return a very high number and not zero, so I'd propose checking first for a saturated bloom and returning max uint32 explicitly.
See: golang/go#56023
Metadata
Metadata
Assignees
Labels
No labels