math

package
v1.7.2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: BSD-3-Clause Imports: 4 Imported by: 152

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add64

func Add64(a, b uint64) (uint64, error)

Add64 returns: 1) a + b 2) If there is overflow, an error

func Diff64

func Diff64(a, b uint64) uint64

func Max64

func Max64(max uint64, nums ...uint64) uint64

Max64 returns the maximum of the values provided

func Min64

func Min64(min uint64, nums ...uint64) uint64

Min64 returns the minimum of the values provided

func Mul64

func Mul64(a, b uint64) (uint64, error)

Mul64 returns: 1) a * b 2) If there is overflow, an error

func Sub64

func Sub64(a, b uint64) (uint64, error)

Sub64 returns: 1) a - b 2) If there is underflow, an error

Types

type Averager added in v1.0.4

type Averager interface {
	// Observe the value at the given time
	Observe(value float64, currentTime time.Time)

	// Read returns the average of the provided values.
	Read() float64
}

Averager tracks a continuous time exponential moving average of the provided values.

func NewAverager added in v1.0.4

func NewAverager(
	initialPrediction float64,
	halflife time.Duration,
	currentTime time.Time,
) Averager

func NewSyncAverager added in v1.2.4

func NewSyncAverager(averager Averager) Averager

Jump to

Keyboard shortcuts

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