sFloats

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareFloats added in v0.1.8

func CompareFloats(v1, v2 float64, prec int) int

func ComparePrecFloat added in v0.1.8

func ComparePrecFloat(v1, v2 float64, prec int) float64

ComparePrecFloat, "v1>v2: >0", "v1<v2: <0", "v1=v2: 0"

func CompareTruncFloat added in v0.1.8

func CompareTruncFloat(v1, v2 float64, prec int) float64

CompareTruncFloat, "v1>v2: >0", "v1<v2: <0", "v1=v2: 0"

func Get64

func Get64(str string) float64

func GetDiffAbs added in v0.1.8

func GetDiffAbs(fromValue, toValue float64) float64

func GetDiffPercent added in v0.1.8

func GetDiffPercent(fromValue, toValue float64) float64

func GetDiffPercentAbs added in v0.1.8

func GetDiffPercentAbs(fromValue, toValue float64) float64

func GetPrecFloat added in v0.1.8

func GetPrecFloat(value float64, prec int) float64

func GetTruncFloat added in v0.1.8

func GetTruncFloat(value float64, prec int) float64

func GetTruncFloatPlus added in v0.1.8

func GetTruncFloatPlus(value float64, prec, plus int) float64

trunc a float value an add a plus value at prec decimal

func GetValid added in v0.1.1

func GetValid(f float64) float64

func GetWithPercent

func GetWithPercent(value, percent float64, adding bool) float64

Adding or Subtracting percent to value

func MinMax added in v0.1.2

func MinMax(values []float64, zero bool) (float64, float64)

MinMax positive values of the float slice, including "0" or not

func ToString added in v0.1.1

func ToString(v float64, prec int) string

Types

type Average added in v0.1.2

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

func NewAverage added in v0.1.2

func NewAverage() *Average

func (*Average) Add added in v0.1.2

func (a *Average) Add(v float64)

func (*Average) Calc added in v0.1.2

func (a *Average) Calc() float64

func (*Average) Qty added in v0.1.2

func (a *Average) Qty() int

func (*Average) Reset added in v0.1.2

func (a *Average) Reset()

func (*Average) String added in v0.1.2

func (a *Average) String() string

func (*Average) Value added in v0.1.2

func (a *Average) Value() float64

type PeriodValues added in v0.1.2

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

func NewPeriodValues added in v0.1.2

func NewPeriodValues(period int) *PeriodValues

func (*PeriodValues) Add added in v0.1.2

func (pv *PeriodValues) Add(value float64)

func (*PeriodValues) DeepCopy added in v0.1.2

func (pv *PeriodValues) DeepCopy() *PeriodValues

func (*PeriodValues) Fill added in v0.1.2

func (pv *PeriodValues) Fill(value float64) bool

Fill adds a value to the PeriodValues if it is not filled yet and returns true. If the PeriodValues is already filled, it returns false. Fill inverse order of Add.

func (*PeriodValues) Filled added in v0.1.2

func (pv *PeriodValues) Filled() bool

func (*PeriodValues) Log added in v0.1.2

func (pv *PeriodValues) Log(qty int)

func (*PeriodValues) Mean added in v0.1.2

func (pv *PeriodValues) Mean() float64

func (*PeriodValues) MeanStdDev added in v0.1.3

func (pv *PeriodValues) MeanStdDev() (mean, std float64)

func (*PeriodValues) Period added in v0.1.3

func (pv *PeriodValues) Period() int

func (*PeriodValues) Sum added in v0.1.3

func (pv *PeriodValues) Sum() float64

func (*PeriodValues) ToFill added in v0.1.2

func (pv *PeriodValues) ToFill() int

func (*PeriodValues) Values added in v0.1.2

func (pv *PeriodValues) Values() []float64

type PeriodValuesMinMax added in v0.1.2

type PeriodValuesMinMax struct {
	*PeriodValues
	// contains filtered or unexported fields
}

func NewPeriodValuesMinMax added in v0.1.2

func NewPeriodValuesMinMax(period int) *PeriodValuesMinMax

func (*PeriodValuesMinMax) Add added in v0.1.2

func (pv *PeriodValuesMinMax) Add(value float64)

func (*PeriodValuesMinMax) DeepCopy added in v0.1.2

func (pv *PeriodValuesMinMax) DeepCopy() *PeriodValuesMinMax

func (*PeriodValuesMinMax) Fill added in v0.1.2

func (pv *PeriodValuesMinMax) Fill(value float64) bool

func (*PeriodValuesMinMax) Log added in v0.1.2

func (pv *PeriodValuesMinMax) Log(qty int)

func (*PeriodValuesMinMax) Max added in v0.1.2

func (pv *PeriodValuesMinMax) Max() float64

func (*PeriodValuesMinMax) Min added in v0.1.2

func (pv *PeriodValuesMinMax) Min() float64

type SmoothedAverage added in v0.1.3

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

func NewSmoothedAverage added in v0.1.3

func NewSmoothedAverage(period int) *SmoothedAverage

func (*SmoothedAverage) AddNeg added in v0.1.3

func (sa *SmoothedAverage) AddNeg(v float64)

AddNeg subtracts a value from the average

func (*SmoothedAverage) AddPos added in v0.1.3

func (sa *SmoothedAverage) AddPos(v float64)

AddPos adds a value to the average

func (*SmoothedAverage) Filled added in v0.1.3

func (sa *SmoothedAverage) Filled() bool

func (*SmoothedAverage) Log added in v0.1.5

func (sa *SmoothedAverage) Log()

func (*SmoothedAverage) Period added in v0.1.3

func (sa *SmoothedAverage) Period() int

func (*SmoothedAverage) String added in v0.1.5

func (sa *SmoothedAverage) String() string

func (*SmoothedAverage) Value added in v0.1.3

func (sa *SmoothedAverage) Value() float64

Jump to

Keyboard shortcuts

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