Documentation ¶
Overview ¶
Package to operate on 128-bit decimal fixed point
Package to operate on 128-bit decimal fixed point
Index ¶
- type UDec128
- func Float64ToUDec128(a float64, precision uint) (UDec128, error)
- func LocaleParseUDec128(lang, str string, precision uint, rounding bool) (UDec128, error)
- func LocaleParseUDec128Bytes(lang string, strInput []byte, precision uint, rounding bool) (UDec128, error)
- func ParseUDec128(str string, precision uint, rounding bool) (UDec128, error)
- func ParseUDec128Bytes(str []byte, precision uint, rounding bool) (UDec128, error)
- func UDec128DivFull(hi, lo, b UDec128) UDec128
- func (a UDec128) Add(b UDec128) UDec128
- func (a UDec128) Add64(b uint64) UDec128
- func (a UDec128) AddC(b UDec128, oldCarry uint64) (UDec128, uint64)
- func (a UDec128) Cmp(b UDec128) int
- func (a UDec128) Div(b UDec128, precision uint) UDec128
- func (a UDec128) Div64(b uint64) UDec128
- func (a UDec128) Format(precision uint, trimZeroes bool) string
- func (a UDec128) FormatBytes(precision uint, trimZeroes bool) []byte
- func (a UDec128) FormatNew(precision, displayPrecision uint, trimZeroes bool) string
- func (a UDec128) FormatNewBytes(precision, displayPrecision uint, trimZeroes bool) []byte
- func (a UDec128) IsZero() bool
- func (a UDec128) LocaleFormat(lang string, precision uint, trimZeroes, noSep1000 bool) string
- func (a UDec128) LocaleFormatBytes(lang string, precision uint, trimZeroes, noSep1000 bool) []byte
- func (a UDec128) LocaleFormatNew(lang string, precision, displayPrecision uint, trimZeroes, noSep1000 bool) string
- func (a UDec128) LocaleFormatNewBytes(lang string, precision, displayPrecision uint, trimZeroes, noSep1000 bool) []byte
- func (a UDec128) Mul(b UDec128, precision uint, rounding bool) UDec128
- func (a UDec128) Mul64(b uint64) UDec128
- func (a UDec128) MulFull(b UDec128) (UDec128, UDec128)
- func (a UDec128) Shl(b uint) UDec128
- func (a UDec128) Shr(b uint) UDec128
- func (a UDec128) Sub(b UDec128) UDec128
- func (a UDec128) Sub64(b uint64) UDec128
- func (a UDec128) SubB(b UDec128, oldBorrow uint64) (UDec128, uint64)
- func (a UDec128) ToFloat64(precision uint) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UDec128 ¶
func Float64ToUDec128 ¶
convert float64 to UDec128
func LocaleParseUDec128 ¶
parse decimal fixed point from string and return value and error (nil if no error)
func LocaleParseUDec128Bytes ¶
func LocaleParseUDec128Bytes(lang string, strInput []byte, precision uint, rounding bool) (UDec128, error)
parse decimal fixed point from string and return value and error (nil if no error)
func ParseUDec128 ¶
parse number from string
func ParseUDec128Bytes ¶
parse number from bytes
func UDec128DivFull ¶
fixed point is in 10**(precision*2)
func (UDec128) Cmp ¶
compare 128-bit decimal fixed points and return 0 if they equal, 1 if first is greater than second, or -1 if first is lesser than second
func (UDec128) FormatBytes ¶
format number to bytes
func (UDec128) FormatNewBytes ¶
new format routine with additional displayPrecision argument. Format to bytes
func (UDec128) LocaleFormat ¶
func (UDec128) LocaleFormatBytes ¶
func (UDec128) LocaleFormatNew ¶
func (a UDec128) LocaleFormatNew(lang string, precision, displayPrecision uint, trimZeroes, noSep1000 bool) string
format 128-bit decimal fixed point including locale
func (UDec128) LocaleFormatNewBytes ¶
func (a UDec128) LocaleFormatNewBytes(lang string, precision, displayPrecision uint, trimZeroes, noSep1000 bool) []byte
format 128-bit decimal fixed point including locale
func (UDec128) Mul64 ¶
multiply 128-bit decimal fixed point and 64-bit unsigned integer and return lower 128 bits product
func (UDec128) MulFull ¶
multiply 128-bit decimal fixed point and return high and lower product integer part is multiplied by 10**precision