scaleoffset

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply[T Numeric](value T, scale, offset float64) float64

Apply applies scale and offset on value.

func ApplyAny

func ApplyAny(value any, scale, offset float64) any

ApplyAny applies scale and offset when possible, otherwise return original value. This function can only accept primitive-types value such as int8, []int8, uint32, []uint32, etc.

func ApplySlice

func ApplySlice[S []E, E Numeric](values S, scale, offset float64) []float64

Apply applies scale and offset on slice values.

func Discard

func Discard(value, scale, offset float64) float64

Discard discards applied scale and offset on value.

func DiscardAny

func DiscardAny(value any, baseType basetype.BaseType, scale, offset float64) any

DiscardAny restores scaled value in the form of float64 or []float64 to its basetype's form.

func DiscardSlice

func DiscardSlice[E Numeric](values []float64, scale, offset float64) []E

DiscardSlice discards applied scale and offset on slice values.

Types

type Numeric

type Numeric interface {
	constraints.Integer | constraints.Float
}

Jump to

Keyboard shortcuts

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