# HyperLogLogMetadata

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:12](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L12)

Read-only configuration and accuracy metadata shared by every scalar variant.

## Extended by

* [`BytesHyperLogLog`](/reference/knotkit/scalar-sketch/interfaces/byteshyperloglog/)
* [`StringHyperLogLog`](/reference/knotkit/scalar-sketch/interfaces/stringhyperloglog/)
* [`Uint32HyperLogLog`](/reference/knotkit/scalar-sketch/interfaces/uint32hyperloglog/)
* [`Uint64HyperLogLog`](/reference/knotkit/scalar-sketch/interfaces/uint64hyperloglog/)

## Properties

### kind

> `readonly` **kind**: `"hyperloglog"`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:13](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L13)

***

### scalarKind

> `readonly` **scalarKind**: `"string"` | `"uint32"` | `"uint64"` | `"bytes"`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:14](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L14)

***

### precision

> `readonly` **precision**: `number`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:16](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L16)

Effective register precision. The register count is `2 ** precision`.

***

### registerCount

> `readonly` **registerCount**: `number`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:18](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L18)

Number of one-byte maximum-rank registers.

***

### stateByteLength

> `readonly` **stateByteLength**: `number`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:20](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L20)

Bytes occupied by the mutable register state, excluding object overhead.

***

### estimator

> `readonly` **estimator**: `"ertl-improved-raw"`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:22](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L22)

The cardinality estimator applied by [estimate](/reference/knotkit/scalar-sketch/interfaces/hyperloglogmetadata/#estimate).

***

### relativeStandardError

> `readonly` **relativeStandardError**: `number`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:24](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L24)

Approximate one-standard-deviation relative error, `1.04 / sqrt(registerCount)`.

***

### seed

> `readonly` **seed**: `bigint`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:26](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L26)

XXH64 seed that participates in merge compatibility.

***

### estimate

> **estimate**: () => `number`

Defined in: [packages/scalar-sketch/src/hyperloglog.ts:39](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/scalar-sketch/src/hyperloglog.ts#L39)

Estimate the number of distinct updates. O(registerCount) after an update or merge that changes a register, O(1) for repeated or no-op reads; does not change the sketch’s registers.

Uses Otmar Ertl’s improved raw estimator without empirical lookup tables. The estimator is monotone, returns exactly zero for an empty sketch, and remains a floating-point query result rather than persisted state. The statistical error is described by [relativeStandardError](/reference/knotkit/scalar-sketch/interfaces/hyperloglogmetadata/#relativestandarderror); it is not a hard bound.

#### Returns

`number`

#### See

[New cardinality estimation algorithms for HyperLogLog sketches](https://oertl.github.io/hyperloglog-sketch-estimation-paper/paper/paper.pdf)
