Documentation
¶
Overview ¶
Package decimal provides a wrapper around github.com/shopspring/decimal for arbitrary-precision fixed-point decimal numbers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Zero = decimal.Zero One = decimal.NewFromInt(1) Two = decimal.NewFromInt(2) Three = decimal.NewFromInt(3) Four = decimal.NewFromInt(4) Five = decimal.NewFromInt(5) Six = decimal.NewFromInt(6) Seven = decimal.NewFromInt(7) Eight = decimal.NewFromInt(8) Nine = decimal.NewFromInt(9) Ten = decimal.NewFromInt(10) )
Common decimal constants.
View Source
var ( New = decimal.New NewFromFloat = decimal.NewFromFloat NewFromFloat32 = decimal.NewFromFloat32 NewFromFloatWithExponent = decimal.NewFromFloatWithExponent NewFromInt = decimal.NewFromInt NewFromInt32 = decimal.NewFromInt32 NewFromUint64 = decimal.NewFromUint64 NewFromBigInt = decimal.NewFromBigInt NewFromBigRat = decimal.NewFromBigRat NewFromString = decimal.NewFromString NewFromFormattedString = decimal.NewFromFormattedString RequireFromString = decimal.RequireFromString )
Constructors for creating Decimal values.
View Source
var ( Max = decimal.Max Min = decimal.Min Sum = decimal.Sum Avg = decimal.Avg RescalePair = decimal.RescalePair )
Utility functions for decimal operations.
Functions ¶
This section is empty.
Types ¶
type Decimal ¶
Decimal is an alias for decimal.Decimal.
func MustFromAny ¶
MustFromAny is like NewFromAny but panics if the value cannot be converted.
func NewFromAny ¶
NewFromAny creates a Decimal from an arbitrary value. Supported types: Decimal, *Decimal, int/int8/int16/int32/int64, uint/uint8/uint16/uint32/uint64, float32, float64, string, []byte, bool (true=1, false=0), and fmt.Stringer. Returns an error for unsupported types.
Click to show internal directories.
Click to hide internal directories.