package logarithm

import "go.opentelemetry.io/otel/sdk/metric/aggregator/exponential/mapping/logarithm"

Index

Constants

const (
	// MinScale ensures that the ../exponent mapper is used for
	// zero and negative scale values.  Do not use the logarithm
	// mapper for scales <= 0.
	MinScale int32 = 1

	// MaxScale is selected as the largest scale that is possible
	// in current code, considering there are 10 bits of base-2
	// exponent combined with scale-bits of range.  At this scale,
	// the growth factor is 0.0000661%.
	//
	// Scales larger than 20 complicate the logic in cmd/prebuild,
	// because math/big overflows when exponent is math.MaxInt32
	// (== the index of math.MaxFloat64 at scale=21),
	//
	// At scale=20, index values are in the interval [-0x3fe00000,
	// 0x3fffffff], having 31 bits of information.  This is
	// sensible given that the OTLP exponential histogram data
	// point uses a signed 32 bit integer for indices.
	MaxScale int32 = 20

	// MaxValue is the largest normal number.
	MaxValue = math.MaxFloat64

	// MinValue is the smallest normal number.
	MinValue = 0x1p-1022
)

Functions

func NewMapping

func NewMapping(scale int32) (mapping.Mapping, error)

NewMapping constructs a logarithm mapping function, used for scales > 0.

Source Files

logarithm.go

Version
v0.29.0
Published
Apr 11, 2022
Platform
linux/amd64
Imports
5 packages
Last checked
3 hours ago

Tools for package owners.