Documentation
¶
Overview ¶
Package decimal implements the bounded base-ten pipeline numeric contract.
Index ¶
- Constants
- Variables
- func ValidateDeclaration(precision, scale int) error
- type Value
- func (v Value) CanonicalJSONNumber() json.Number
- func (v Value) Cmp(other Value) int
- func (v Value) EstimatedBytes() int64
- func (v Value) Inexact() bool
- func (v Value) MarshalJSON() ([]byte, error)
- func (v Value) Operation(other Value, operation string) (Value, error)
- func (v Value) Quantize(precision, scale int) (Value, error)
- func (v Value) Rat() *big.Rat
- func (v Value) Rounded() bool
- func (v Value) String() string
Constants ¶
const MaxPrecision = 38
Variables ¶
var ErrConversion = xerror.New(xerror.KindInvalidInput, "PIPELINE_DECIMAL_CONVERSION", "invalid bounded decimal conversion")
Functions ¶
func ValidateDeclaration ¶
Types ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is immutable; operations allocate a destination and never mutate operands. The zero value represents decimal zero.
func (Value) CanonicalJSONNumber ¶
CanonicalJSONNumber uses encoding/json's exponent thresholds while retaining all digits.
func (Value) EstimatedBytes ¶
EstimatedBytes includes coefficient storage as well as the serialized token.