Movatterモバイル変換


[0]ホーム

URL:


maths

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:2Imported by:0

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package maths contains additional mathematical functions or structures notfound in the standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeEWMA

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

EWMA is an exponentially weighted moving average supporting updates atirregular intervals with at most nanosecond resolution.The zero value will compute a half-life of 1 second.It is not safe for concurrent use.TODO(raggi): de-duplicate with tstime/rate.Value, which has a more complexand synchronized interface and does not provide direct access to the stablevalue.

funcNewEWMA

func NewEWMA(halfLifeSecondsfloat64) *EWMA

NewEWMA creates a new EWMA with the specified half-life. If halfLifeSecondsis 0, it defaults to 1.

func (*EWMA)Get

func (e *EWMA) Get()float64

Get returns the current value of the average

func (*EWMA)Reset

func (e *EWMA) Reset()

Reset clears the EWMA to its initial state

func (*EWMA)Update

func (e *EWMA) Update(valuefloat64, ttime.Time)

Update adds a new sample to the average. If t is zero or precedes the lastupdate, the update is ignored.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp