First, thanks for this great library !
However, I noticed a typo that causes very large cardinalities to be underestimated.
Amplitude of the error (using $2^{20}$ registers):
The relative error is around $10^{-6}$ for a count of $2^{35}$, but it grows with larger cardinalities: counting $2^{40}$ elements underestimates by around $2^{-10}$, and for $2^{45}$ the error is large, around 10%.
The culprit: function clz
Function clz has a typo that causes it to return 24 when it should return 25 or 26.
Here is the typo at line 1151 of src/hll.c.
First, thanks for this great library ! However, I noticed a typo that causes very large cardinalities to be underestimated.
Amplitude of the error (using $2^{20}$ registers): The relative error is around $10^{-6}$ for a count of $2^{35}$, but it grows with larger cardinalities: counting $2^{40}$ elements underestimates by around $2^{-10}$, and for $2^{45}$ the error is large, around 10%.
The culprit: function
clz
Functionclz
has a typo that causes it to return 24 when it should return 25 or 26. Here is the typo at line 1151 ofsrc/hll.c
.