decimal

package
v0.0.52 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AmountPrecision = 2 // 金额精度 保留2位小数
)

Variables

This section is empty.

Functions

func Add

func Add(a, b float64, percision ...int) float64

func Div

func Div(a, b float64, percision ...int) float64

func Equal

func Equal(a, b float64) bool

func Mul

func Mul(a, b float64, percision ...int) float64

func Round

func Round(val float64, use ...int) float64

func Sub

func Sub(a, b float64, percision ...int) float64

Types

type Decimal added in v0.0.22

type Decimal struct {
	// contains filtered or unexported fields
}

func New added in v0.0.22

func New(precision int) *Decimal

func (*Decimal) Add added in v0.0.22

func (d *Decimal) Add(a, b float64) float64

func (*Decimal) Div added in v0.0.22

func (d *Decimal) Div(a, b float64) float64

func (*Decimal) Mul added in v0.0.22

func (d *Decimal) Mul(a, b float64) float64

func (*Decimal) Round added in v0.0.22

func (d *Decimal) Round(val float64) float64

func (*Decimal) Sub added in v0.0.22

func (d *Decimal) Sub(a, b float64) float64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL