项目地址:
https://github.com/shopspring/decimal
使用示例:
package main import ( "fmt" "github.com/shopspring/decimal" ) func main() { fl := 3.1415926 de := decimal.NewFromFloat(fl) de = de.Round(2) // 四舍五入:保留两位小数 str := de.String() fmt.Println(str) // 输出:3.14 }
文档更新时间: 2024-04-20 10:57 作者:lee