first commit

This commit is contained in:
2025-08-05 22:50:44 +08:00
commit a981187a8c
377 changed files with 35686 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)
}