mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Use llroundl() before converting loglog-beta output to integer.
Otherwise for small cardinalities the algorithm will output something like, for example, 4.99 for a candinality of 5, that will be converted to 4 producing a huge error.
This commit is contained in:
parent
47dea01c85
commit
0224be8811
@ -1009,7 +1009,7 @@ uint64_t hllCount(struct hllhdr *hdr, int *invalid) {
|
|||||||
-0.005384159*pow(zl,6) +
|
-0.005384159*pow(zl,6) +
|
||||||
0.00042419*pow(zl,7);
|
0.00042419*pow(zl,7);
|
||||||
|
|
||||||
E = alpha*m*(m-ez)*(1/(E+beta));
|
E = llroundl(alpha*m*(m-ez)*(1/(E+beta)));
|
||||||
} else {
|
} else {
|
||||||
/* Muliply the inverse of E for alpha_m * m^2 to have the raw estimate. */
|
/* Muliply the inverse of E for alpha_m * m^2 to have the raw estimate. */
|
||||||
E = (1/E)*alpha*m*m;
|
E = (1/E)*alpha*m*m;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user