Ai
1 Star 0 Fork 0

小于的个人工具集/xnum

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
price_test.go 485 Bytes
一键复制 编辑 原始数据 按行查看 历史
xiaoyutab 提交于 2023-12-15 15:01 +08:00 . 1
package xnum_test
import (
"testing"
"gitee.com/xgotool/xnum"
)
func TestDiscount(t *testing.T) {
t.Log("100/100%:", xnum.Discount(100, 100))
t.Log("100/80%:", xnum.Discount(100, 80))
t.Log("100/99%:", xnum.Discount(100, 99))
t.Log("9.9/100%:", xnum.Discount(9.9, 100))
t.Log("9.9/80%:", xnum.Discount(9.9, 80))
t.Log("9.9/99%:", xnum.Discount(9.9, 99))
}
// 计算金额部分(保留两位小数)
func TestPrice(t *testing.T) {
t.Log(xnum.Price(0.95 * 1.23 / 100))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xgotool/xnum.git
git@gitee.com:xgotool/xnum.git
xgotool
xnum
xnum
master

搜索帮助