Documentation ¶
Index ¶
- type Decimal64p2
- func (d Decimal64p2) Abs() Decimal64p2
- func (d Decimal64p2) AsFloat64() float64
- func (d Decimal64p2) DecimalPart() int64
- func (d Decimal64p2) IntPart() int64
- func (d Decimal64p2) MarshalJSON() ([]byte, error)
- func (d Decimal64p2) String() string
- func (d *Decimal64p2) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decimal64p2 ¶
type Decimal64p2 int64
Decimal64p2 is a decimal number implementation based on int64 with 2 digits after point fixed precision
func NewDecimal64p2 ¶
func NewDecimal64p2(intPart int64, decimalPart int8) Decimal64p2
NewDecimal64p2 creates Decimal64p2 from integer and decimal parts
func NewDecimal64p2FromFloat64 ¶
func NewDecimal64p2FromFloat64(f float64) Decimal64p2
NewDecimal64p2FromFloat64 creates Decimal64p2 from float64
func NewDecimal64p2FromInt ¶
func NewDecimal64p2FromInt(intPart int) Decimal64p2
NewDecimal64p2FromInt creates Decimal64p2 from integer
func ParseDecimal64p2 ¶
func ParseDecimal64p2(s string) (d Decimal64p2, err error)
ParseDecimal64p2 creates Decimal64p2 from a string
func (Decimal64p2) Abs ¶
func (d Decimal64p2) Abs() Decimal64p2
Abs returns absolute value for the decimal
func (Decimal64p2) AsFloat64 ¶
func (d Decimal64p2) AsFloat64() float64
AsFloat64 converts decimal to float64
func (Decimal64p2) DecimalPart ¶
func (d Decimal64p2) DecimalPart() int64
DecimalPart returns part after point
func (Decimal64p2) IntPart ¶
func (d Decimal64p2) IntPart() int64
IntPart returns integer part of the decimal
func (Decimal64p2) MarshalJSON ¶
func (d Decimal64p2) MarshalJSON() ([]byte, error)
MarshalJSON marshals decimal to JSON
func (Decimal64p2) String ¶
func (d Decimal64p2) String() string
String renders decimal to string. If integer the .00 is NOT rendered.
func (*Decimal64p2) UnmarshalJSON ¶
func (d *Decimal64p2) UnmarshalJSON(data []byte) error
UnmarshalJSON deserializes JSON to decimal