-
Notifications
You must be signed in to change notification settings - Fork 7
添加可选择保留两位小数取出 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
感谢您贡献的代码,虽然之前我并没有这个需求,但想一想可能也是存在的。
所以考虑暂时先不 merge,过段时间看看会不会有更好的解决方法 |
我觉得这个是通用需求啊,一般的金钱显示都是保留两位小数,如果哪里不合规范的话我可以改的 |
我倒感觉不要过度设计了,追求过度通用的话倒有点本末倒置了 |
是这样的,大多数国家的金钱是有2位小数,不过也有一些国家是3位小数,例如西亚伊拉克、约旦、科威特等国的第纳尔 另外这个 repo 的核心作用是便于逻辑的小数和存储的整数间相互转换,标识长度、面积等数量的场景也很方便使用,只考虑金额的话也会限制这些场景。 当然各种场景下,2位小数都是更常见的形式,我觉得默认2位没问题,但是只能2位就不够好了。 您提的这个需求我觉得可能是普遍存在的,只是觉得目前的实现不够普遍,但是我也说不出什么明确的不合规范的地方。 所以我建议先不要着急得出结论,过段时间看看有没有新的想法再说。 |
您好,我按照您的思路又改了一遍 |
由于在业务上发现很多这种需求,加上此判断可以满足,不影响原有逻辑