We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://github.com/thinkeridea/go-extend/blob/main/exmath/round.go 四舍五入函数存在精度问题,如0.565保留两位小数输出的是0.56而不是0.57
The text was updated successfully, but these errors were encountered:
你可能需要了解一些关于浮点数的基础知识,以下是我找到的一些资料:
https://en.wikipedia.org/wiki/IEEE_754 https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/ http://c.biancheng.net/view/314.html
当前函数受浮点数算法影响,无法做到绝对的精准(浮点数本身精度并不高),只是比现有社区其它版本有所改善(精度、性能、api使用简便性),浮点数无法对精度做出保证,在较重要的数值上(例如货币)请使用更小的单位例如分进行存储和计算,展示时转换为浮点数就行展示
Sorry, something went wrong.
No branches or pull requests
https://github.com/thinkeridea/go-extend/blob/main/exmath/round.go
四舍五入函数存在精度问题,如0.565保留两位小数输出的是0.56而不是0.57
The text was updated successfully, but these errors were encountered: