Documentation ¶
Index ¶
- Constants
- Variables
- func Compare(x, y Value) int
- func Count(values []Value, counter Counter) int
- func Equal(x, y Value) bool
- func NegativeTester(value Value) bool
- func Parse(input string) (num int64, numDecimalPoints int, err error)
- func PositiveTester(value Value) bool
- type Ascending
- type Counter
- type Descending
- type Reducer
- type RoundingMode
- type Slice
- type Tester
- type Value
- func Abs(a Value) Value
- func Avg(values []Value) (avg Value)
- func Clamp(x, min, max Value) Value
- func Div(x, y Value) Value
- func Filter(values []Value, f Tester) (slice []Value)
- func Max(a, b Value) Value
- func Min(a, b Value) Value
- func Mul(x, y Value) Value
- func Must(v Value, err error) Value
- func MustNewFromBytes(input []byte) (v Value)
- func MustNewFromString(input string) Value
- func NewFromBytes(input []byte) (Value, error)
- func NewFromFloat(val float64) Value
- func NewFromInt(val int64) Value
- func NewFromString(input string) (Value, error)
- func Reduce(values []Value, reducer Reducer, a ...Value) Value
- func Sum(values []Value) (s Value)
- func SumReducer(prev, curr Value) Value
- func (v Value) Abs() Value
- func (v Value) Add(v2 Value) Value
- func (v *Value) AtomicAdd(v2 Value)
- func (v *Value) AtomicLoad() Value
- func (v Value) Ceil() Value
- func (x Value) Clamp(min, max Value) Value
- func (x Value) Compare(y Value) int
- func (v Value) Div(v2 Value) Value
- func (x Value) Eq(y Value) bool
- func (v Value) Float64() float64
- func (v Value) Floor() Value
- func (v Value) FormatPercentage(prec int) string
- func (v Value) FormatString(prec int) string
- func (v Value) Int() int
- func (v Value) Int64() int64
- func (a Value) IsInf() bool
- func (v Value) IsZero() bool
- func (v Value) MarshalJSON() ([]byte, error)
- func (v Value) MarshalYAML() (interface{}, error)
- func (v Value) Mul(v2 Value) Value
- func (a Value) MulExp(exp int) Value
- func (v Value) Neg() Value
- func (a Value) NumFractionalDigits() int
- func (a Value) NumIntDigits() int
- func (v Value) Percentage() string
- func (v Value) Round(r int, mode RoundingMode) Value
- func (v *Value) Scan(src interface{}) error
- func (v Value) Sign() int
- func (v Value) SignedPercentage() string
- func (v Value) String() string
- func (v Value) Sub(v2 Value) Value
- func (v Value) Trunc() Value
- func (v *Value) UnmarshalJSON(data []byte) error
- func (v *Value) UnmarshalYAML(unmarshal func(a interface{}) error) (err error)
- func (v Value) Value() (driver.Value, error)
Constants ¶
View Source
const DefaultPow = 1e8
View Source
const DefaultPrecision = 8
View Source
const MaxPrecision = 12
View Source
const NegInf = Value(math.MinInt64)
View Source
const NegOne = Value(-1e8)
View Source
const One = Value(1e8)
View Source
const PosInf = Value(math.MaxInt64)
View Source
const Zero = Value(0)
Variables ¶
View Source
var ErrPrecisionLoss = errors.New("precision loss")
Functions ¶
func NegativeTester ¶ added in v1.40.3
func PositiveTester ¶ added in v1.40.3
Types ¶
type Descending ¶ added in v1.40.3
type Descending []Value
func (Descending) Len ¶ added in v1.40.3
func (s Descending) Len() int
func (Descending) Less ¶ added in v1.40.3
func (s Descending) Less(i, j int) bool
func (Descending) Swap ¶ added in v1.40.3
func (s Descending) Swap(i, j int)
type RoundingMode ¶ added in v1.28.0
type RoundingMode int
const ( Up RoundingMode = iota Down HalfUp )
type Value ¶
type Value int64
var ( Two Value = NewFromInt(2) Three Value = NewFromInt(3) Four Value = NewFromInt(4) )
func MustNewFromBytes ¶ added in v1.28.0
func MustNewFromString ¶ added in v1.13.0
func NewFromBytes ¶ added in v1.28.0
func NewFromFloat ¶
func NewFromInt ¶
func NewFromString ¶
func SumReducer ¶ added in v1.40.3
func (*Value) AtomicLoad ¶ added in v1.2.0
func (Value) FormatPercentage ¶ added in v1.28.0
func (Value) FormatString ¶ added in v1.28.0
func (Value) MarshalJSON ¶ added in v1.3.1
func (Value) MarshalYAML ¶ added in v1.33.3
func (Value) NumFractionalDigits ¶ added in v1.28.0
TODO: speedup
func (Value) NumIntDigits ¶ added in v1.28.0
func (Value) Percentage ¶ added in v1.18.0
func (Value) SignedPercentage ¶ added in v1.18.0
func (Value) Trunc ¶ added in v1.28.0
Trunc returns the integer portion (truncating any fractional part)
func (*Value) UnmarshalJSON ¶
func (*Value) UnmarshalYAML ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.