gpt4 book ai didi

java - ROUND_HALF_EVEN 为什么以及如何在重复应用于一系列计算时最小化累积误差?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:13:00 25 4
gpt4 key购买 nike

我听说 ROUND_HALF_EVEN 是财务数据计算的首选舍入模式。我很想知道这种舍入模式为什么以及如何减少 javadoc BigDecimal 1.4.2 中所述的累积误差。谢谢,院长

最佳答案

来自 Wikipedia :

Despite the custom of rounding the number 4.5 up to 5, in fact 4.5 is no nearer to 5 than it is to 4 (it is 0.5 away from both). When dealing with large sets of scientific or statistical data, where trends are important, traditional rounding on average biases the data upwards slightly. Over a large set of data, or when many subsequent rounding operations are performed as in digital signal processing, the round-to-even rule tends to reduce the total rounding error, with (on average) an equal portion of numbers rounding up as rounding down. This generally reduces upwards skewing of the result.

关于java - ROUND_HALF_EVEN 为什么以及如何在重复应用于一系列计算时最小化累积误差?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/792237/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com