fixedpoint

package
v1.25.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 8 Imported by: 125

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 added in v1.15.0

func NumFractionalDigits(a Value) int

func Parse added in v1.14.0

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

Types

type Value

type Value int64

func Abs added in v1.17.0

func Abs(a Value) Value

func Max added in v1.11.0

func Max(a, b Value) Value

func Min added in v1.11.0

func Min(a, b Value) Value

func Must

func Must(v Value, err error) Value

func MustNewFromString added in v1.13.0

func MustNewFromString(input string) Value

func NewFromAny added in v1.21.0

func NewFromAny(any interface{}) (Value, error)

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) Abs added in v1.18.0

func (v Value) Abs() Value

func (Value) Add

func (v Value) Add(v2 Value) Value

func (*Value) AtomicAdd added in v1.2.0

func (v *Value) AtomicAdd(v2 Value)

func (*Value) AtomicLoad added in v1.2.0

func (v *Value) AtomicLoad() Value

func (Value) BigMul added in v1.17.0

func (v Value) BigMul(v2 Value) Value

BigMul is the math/big version multiplication

func (Value) Ceil added in v1.17.0

func (v Value) Ceil() Value

func (Value) Div

func (v Value) Div(v2 Value) Value

func (Value) DivFloat64 added in v1.15.4

func (v Value) DivFloat64(v2 float64) Value

func (Value) Float64

func (v Value) Float64() float64

func (Value) Floor added in v1.14.0

func (v Value) Floor() Value

func (Value) Int added in v1.17.0

func (v Value) Int() int

func (Value) Int64

func (v Value) Int64() int64

func (Value) MarshalJSON added in v1.3.1

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) MulInt added in v1.17.0

func (v Value) MulInt(v2 int) Value

func (Value) Percentage added in v1.18.0

func (v Value) Percentage() string

func (*Value) Scan added in v1.13.0

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

func (Value) SignedPercentage added in v1.18.0

func (v Value) SignedPercentage() string

func (Value) String added in v1.17.0

func (v Value) String() string

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 added in v1.13.0

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