math

package
v0.0.0-...-bbb0757 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Digits

func Digits[T int32 | int64](value T) int

Digits returns the number of digits required to represent value with base 10.

func EstimatedDigitsInt32

func EstimatedDigitsInt32(value int32) int

EstimatedDigitsInt32 returns the estimated number of digits required to represent value with base 10. The returned estimation should always be >= that the actual number of digits, but never lower.

func EstimatedDigitsInt64

func EstimatedDigitsInt64(value int64) int

EstimatedDigitsInt64 returns the estimated number of digits required to represent value with base 10. The returned estimation should always be >= that the actual number of digits, but never lower.

Types

type EwmaRate

type EwmaRate struct {
	// contains filtered or unexported fields
}

EwmaRate tracks an exponentially weighted moving average of a per-second rate.

func NewEWMARate

func NewEWMARate(alpha float64, interval time.Duration) *EwmaRate

func (*EwmaRate) Add

func (r *EwmaRate) Add(delta int64)

func (*EwmaRate) Inc

func (r *EwmaRate) Inc()

Inc counts one event.

func (*EwmaRate) Rate

func (r *EwmaRate) Rate() float64

Rate returns the per-second rate.

func (*EwmaRate) Tick

func (r *EwmaRate) Tick()

Tick assumes to be called every r.interval.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL