first commit

This commit is contained in:
2025-01-10 00:09:25 +08:00
commit f54ead0f90
215 changed files with 16058 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package tool
import "github.com/shopspring/decimal"
var oneHundredDecimal decimal.Decimal = decimal.NewFromInt(100)
//分转元
func Fen2Yuan(fen int64) float64 {
y, _ := decimal.NewFromInt(fen).Div(oneHundredDecimal).Truncate(2).Float64()
return y
}
//元转分
func Yuan2Fen(yuan float64) int64 {
f, _ := decimal.NewFromFloat(yuan).Mul(oneHundredDecimal).Truncate(0).Float64()
return int64(f)
}