Documentation
¶
Index ¶
- func AppendFixedPointDecimal(b []byte, v int64, p int) []byte
- func Comparator(a, b FpDecimal) int
- func FixedPointDecimalToString(v int64, p int) string
- func Log10Int(d FpDecimal) int
- func ParseFixedPointDecimal(s string) (int64, uint, error)
- type FpDecimal
- func Add(a, b FpDecimal) (FpDecimal, error)
- func FromFloat64(f float64, precision uint) FpDecimal
- func FromInt64(i int64) FpDecimal
- func FromString(s string) (FpDecimal, error)
- func GetOne() FpDecimal
- func GetZero() FpDecimal
- func NewFpDecimal(precision uint) FpDecimal
- func Sub(a, b FpDecimal) (FpDecimal, error)
- func (d FpDecimal) Div(v FpDecimal) (FpDecimal, error)
- func (d FpDecimal) DivInteger(i int64) (FpDecimal, error)
- func (d *FpDecimal) Float32() float32
- func (d *FpDecimal) Float64() float64
- func (d *FpDecimal) GetPrecision() uint
- func (d *FpDecimal) IsZero() bool
- func (d *FpDecimal) MarshalJSON() ([]byte, error)
- func (d FpDecimal) MulInteger(i int64) (FpDecimal, error)
- func (d FpDecimal) Neg() FpDecimal
- func (d FpDecimal) Percent() string
- func (d FpDecimal) Sign() int
- func (d FpDecimal) String() string
- func (d *FpDecimal) To(precision uint) bool
- func (d *FpDecimal) ToPrecision(n uint) string
- func (d *FpDecimal) UnmarshalJSON(b []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFixedPointDecimal ¶
AppendFixedPointDecimal appends formatted fixed point decimal to destination buffer. Returns appended slice. This is efficient for avoiding memory copy. strconv.AppendInt is very efficient. Efficient converting int64 to ASCII is not as trivial.
func Comparator ¶ added in v0.0.13
func FixedPointDecimalToString ¶
FixedPointDecimalToString formats fixed-point decimal to string
Types ¶
type FpDecimal ¶
type FpDecimal struct {
// contains filtered or unexported fields
}
func Add ¶ added in v0.0.5
Preserve the larger precision. It will throw an error when these efforts fail
func FromFloat64 ¶
func FromString ¶
func NewFpDecimal ¶
func Sub ¶ added in v0.0.5
Preserve the larger precision. It will throw an error when these efforts fail
func (FpDecimal) DivInteger ¶ added in v0.0.8
no guarantee on precision of the result
func (*FpDecimal) GetPrecision ¶
func (*FpDecimal) MarshalJSON ¶
func (FpDecimal) MulInteger ¶ added in v0.0.8
func (*FpDecimal) ToPrecision ¶ added in v0.0.10
func (*FpDecimal) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.