Versions in this module Expand all Collapse all v0 v0.0.2 Jun 13, 2026 v0.0.1 Jun 12, 2026 Changes in this version + const DefaultPrec + const MaxPrec + var ErrDivideByZero = errors.New("zerodecimal: division by zero") + var ErrEmptyString = errors.New("zerodecimal: empty input") + var ErrIntPartOverflow = errors.New("zerodecimal: integer part overflows int64") + var ErrInvalidBinaryData = errors.New("zerodecimal: invalid binary data") + var ErrInvalidFloat = errors.New("zerodecimal: NaN or Infinity") + var ErrInvalidFormat = errors.New("zerodecimal: invalid format") + var ErrMaxStrLen = errors.New("zerodecimal: input exceeds 200 bytes") + var ErrOverflow = errors.New("zerodecimal: value overflows 128-bit coefficient") + var ErrPrecOutOfRange = errors.New("zerodecimal: precision out of range") + var ErrScanNil = errors.New("zerodecimal: cannot scan nil into Decimal") + var ErrScanType = errors.New("zerodecimal: unsupported Scan source type") + var One = NewFromInt(1) + var Zero = Decimal + type Decimal struct + func Avg(first Decimal, rest ...Decimal) (Decimal, error) + func Max(first Decimal, rest ...Decimal) Decimal + func Min(first Decimal, rest ...Decimal) Decimal + func MustAvg(first Decimal, rest ...Decimal) Decimal + func MustNew(value int64, exp int32) Decimal + func MustSum(first Decimal, rest ...Decimal) Decimal + func New(value int64, exp int32) (Decimal, error) + func NewFromFloat(f float64) (Decimal, error) + func NewFromFloat32(f float32) (Decimal, error) + func NewFromHiLo(neg bool, hi, lo uint64, prec uint8) (Decimal, error) + func NewFromInt(v int64) Decimal + func NewFromInt32(v int32) Decimal + func NewFromString(s string) (Decimal, error) + func NewFromStringTrunc(s string) (Decimal, error) + func NewFromUint64(v uint64) Decimal + func ParseBytes(b []byte) (Decimal, error) + func ParseBytesTrunc(b []byte) (Decimal, error) + func RequireFromFloat(f float64) Decimal + func RequireFromString(s string) Decimal + func Sum(first Decimal, rest ...Decimal) (Decimal, error) + func (d *Decimal) Scan(src any) error + func (d *Decimal) UnmarshalBinary(data []byte) error + func (d *Decimal) UnmarshalJSON(data []byte) error + func (d *Decimal) UnmarshalText(b []byte) error + func (d Decimal) Abs() Decimal + func (d Decimal) Add(e Decimal) (Decimal, error) + func (d Decimal) AppendBinary(b []byte) ([]byte, error) + func (d Decimal) AppendFixed(b []byte, places uint8) []byte + func (d Decimal) AppendText(b []byte) ([]byte, error) + func (d Decimal) Ceil() Decimal + func (d Decimal) Cmp(e Decimal) int + func (d Decimal) Div(e Decimal) (Decimal, error) + func (d Decimal) Equal(e Decimal) bool + func (d Decimal) Floor() Decimal + func (d Decimal) GreaterThan(e Decimal) bool + func (d Decimal) GreaterThanOrEqual(e Decimal) bool + func (d Decimal) InexactFloat64() float64 + func (d Decimal) IntPart() (int64, error) + func (d Decimal) IsNegative() bool + func (d Decimal) IsPositive() bool + func (d Decimal) IsZero() bool + func (d Decimal) LessThan(e Decimal) bool + func (d Decimal) LessThanOrEqual(e Decimal) bool + func (d Decimal) MarshalBinary() ([]byte, error) + func (d Decimal) MarshalJSON() ([]byte, error) + func (d Decimal) MarshalText() ([]byte, error) + func (d Decimal) Mod(e Decimal) (Decimal, error) + func (d Decimal) Mul(e Decimal) (Decimal, error) + func (d Decimal) MustAdd(e Decimal) Decimal + func (d Decimal) MustDiv(e Decimal) Decimal + func (d Decimal) MustMod(e Decimal) Decimal + func (d Decimal) MustMul(e Decimal) Decimal + func (d Decimal) MustQuoRem(e Decimal) (Decimal, Decimal) + func (d Decimal) MustSub(e Decimal) Decimal + func (d Decimal) Neg() Decimal + func (d Decimal) Prec() uint8 + func (d Decimal) QuoRem(e Decimal) (Decimal, Decimal, error) + func (d Decimal) Round(places uint8) Decimal + func (d Decimal) RoundBank(places uint8) Decimal + func (d Decimal) RoundCeil(places uint8) Decimal + func (d Decimal) RoundDown(places uint8) Decimal + func (d Decimal) RoundFloor(places uint8) Decimal + func (d Decimal) RoundUp(places uint8) Decimal + func (d Decimal) Sign() int + func (d Decimal) String() string + func (d Decimal) StringFixed(places uint8) string + func (d Decimal) Sub(e Decimal) (Decimal, error) + func (d Decimal) ToHiLo() (neg bool, hi, lo uint64, prec uint8) + func (d Decimal) Truncate(places uint8) Decimal + func (d Decimal) Value() (driver.Value, error) + type NullDecimal struct + Decimal Decimal + Valid bool + func NewNullDecimal(d Decimal) NullDecimal + func (n *NullDecimal) Scan(src any) error + func (n *NullDecimal) UnmarshalJSON(data []byte) error + func (n *NullDecimal) UnmarshalText(b []byte) error + func (n NullDecimal) MarshalJSON() ([]byte, error) + func (n NullDecimal) MarshalText() ([]byte, error) + func (n NullDecimal) Value() (driver.Value, error)