MCPcopy Create free account
hub / github.com/F-Stack/f-stack / hllTau

Function hllTau

app/redis-6.2.6/src/hyperloglog.c:988–1000  ·  view source on GitHub ↗

Helper function tau as defined in * "New cardinality estimation algorithms for HyperLogLog sketches" * Otmar Ertl, arXiv:1702.01284 */

Source from the content-addressed store, hash-verified

986 * "New cardinality estimation algorithms for HyperLogLog sketches"
987 * Otmar Ertl, arXiv:1702.01284 */
988double hllTau(double x) {
989 if (x == 0. || x == 1.) return 0.;
990 double zPrime;
991 double y = 1.0;
992 double z = 1 - x;
993 do {
994 x = sqrt(x);
995 zPrime = z;
996 y *= 0.5;
997 z -= pow(1 - x, 2)*y;
998 } while(zPrime != z);
999 return z / 3;
1000}
1001
1002/* Return the approximated cardinality of the set based on the harmonic
1003 * mean of the registers values. 'hdr' points to the start of the SDS

Callers 1

hllCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected