piecefunc

package
v1.0.2-rc.6 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DecimalUnit is used to define ratios with integers, it's 1.0
	DecimalUnit = 1e6
)

Variables

This section is empty.

Functions

func Div

func Div(a, b uint64) uint64

Div is division of ratios with integer numbers

func Mul

func Mul(a, b uint64) uint64

Mul is multiplication of ratios with integer numbers

func NewFunc

func NewFunc(dots []Dot) func(x uint64) uint64

Types

type Dot

type Dot struct {
	X uint64
	Y uint64
}

Dot is a pair of numbers

type Func

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

func (Func) Get

func (f Func) Get(x uint64) uint64

Get calculates f(x), where f is a piecewise linear function defined by the pieces

Jump to

Keyboard shortcuts

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