alphaForOtlpScale

The DDSketch relative accuracy α that aligns exactly with the OTLP exponential-histogram scale: α = (γ−1)/(γ+1) where γ = 2^(2^−scale).

A sketch built with DDSketch.empty(relativeAccuracy = alphaForOtlpScale(s)) exports to an OTLP ExponentialHistogramDataPoint of scale s losslessly — each DDSketch bucket maps one-to-one onto an OTLP bucket (both use upper-inclusive edges; the OTLP index is the DDSketch index minus one).

Larger scales mean tighter accuracy: scale 0 is α = 1/3, scale 5 is α ≈ 1.08%, scale 10 is α ≈ 0.034%.

Parameters

scale

an integer OTLP scale in [-10, 20] (the range the OTLP data model permits).

Throws

if scale is outside that range.