fixedpoint

package
v0.0.0-...-a7cd9b2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPow = 1e8
View Source
const DefaultPrecision = 8
View Source
const MaxPrecision = 12

Variables

View Source
var ErrPrecisionLoss = errors.New("precision loss")

Functions

func NumFractionalDigits

func NumFractionalDigits(a Value) int

func Parse

func Parse(input string) (num int64, numDecimalPoints int, err error)

Types

type Value

type Value int64

func Max

func Max(a, b Value) Value

func Min

func Min(a, b Value) Value

func Must

func Must(v Value, err error) Value

func MustNewFromString

func MustNewFromString(input string) Value

func NewFromFloat

func NewFromFloat(val float64) Value

func NewFromFloat32

func NewFromFloat32(val float32) Value

func NewFromInt

func NewFromInt(val int) Value

func NewFromInt64

func NewFromInt64(val int64) Value

func NewFromString

func NewFromString(input string) (Value, error)

func (Value) Add

func (v Value) Add(v2 Value) Value

func (*Value) AtomicAdd

func (v *Value) AtomicAdd(v2 Value)

func (*Value) AtomicLoad

func (v *Value) AtomicLoad() Value

func (Value) Div

func (v Value) Div(v2 Value) Value

func (Value) Float64

func (v Value) Float64() float64

func (Value) Floor

func (v Value) Floor() Value

func (Value) Int64

func (v Value) Int64() int64

func (Value) MarshalJSON

func (v Value) MarshalJSON() ([]byte, error)

func (Value) Mul

func (v Value) Mul(v2 Value) Value

func (Value) MulFloat64

func (v Value) MulFloat64(v2 float64) Value

func (*Value) Scan

func (v *Value) Scan(src interface{}) error

func (Value) Sub

func (v Value) Sub(v2 Value) Value

func (*Value) UnmarshalJSON

func (v *Value) UnmarshalJSON(data []byte) error

func (*Value) UnmarshalYAML

func (v *Value) UnmarshalYAML(unmarshal func(a interface{}) error) (err error)

func (Value) Value

func (v Value) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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