一个关于求和的精确度的问题!!请教~~~

zy623590014 2009-12-22 12:41:55
To add 0.01+0.02+...+1.00,what order should you use to add the numbers to get better accuracy?


A add 0.01,0.02,...,1.00 in this order to a sum variable whose initial value is 0.
B add 1.00,0.99,...,0.02,0.01 in this order to a sum variable whose initial value is 0.
...全文
110 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wmdtksmld 2009-12-22
  • 打赏
  • 举报
回复
呵呵 学习了
老紫竹 2009-12-22
  • 打赏
  • 举报
回复
BigDecimal 精度更高

或者,你可以把所有的数字×100 变成整数再操作

62,621

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧