Documentation ¶
Index ¶
- type Decimal
- func (d Decimal) Abs() Decimal
- func (d Decimal) Add(v Decimal) Decimal
- func (d Decimal) Div(v Decimal) Decimal
- func (d Decimal) Float64() float64
- func (d Decimal) Invert() Decimal
- func (d Decimal) MarshalJSON() ([]byte, error)
- func (d Decimal) Mul(v Decimal) Decimal
- func (d Decimal) Neg() Decimal
- func (d *Decimal) Set(v float64)
- func (d *Decimal) String() string
- func (d Decimal) Sub(v Decimal) Decimal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decimal ¶
type Decimal int64
Decimal is a fixed precision number with (4) digits of precision.
It blends the benefits of an arbitrary precision type (e.g. math.big) with the performance of register types for common operations.
Addition and subtraction can be done directly on values with the builtin operators. For everything else, there are helper functions on the type itself.
func (Decimal) Abs ¶
Abs returnst the absolute value of the decimal.
It is equivalent to -d if d < 0.
func (Decimal) MarshalJSON ¶
MarshalJSON marshals the decimal as a json.
Click to show internal directories.
Click to hide internal directories.