Python 中的 decimal.ROUND_05UP 在哪里使用?

Where to use decimal.ROUND_05UP in Python?

Python 中的 decimal 模块提供了舍入 Decimal 的选项:

ROUND_05UP

这种舍入有哪些实际用途?

IEEE Decimal Arithmetic 规范是这样说的:

The rounding mode round-05up permits arithmetic at shorter lengths to be emulated in a fixed-precision environment without double rounding. For example, a multiplication at a precision of 9 can be effected by carrying out the multiplication at (say) 16 digits using round-05up and then rounding to the required length using the desired rounding algorithm.

换句话说,如果我们使用 ROUND_05UP 舍入到一个精度,然后使用其他舍入模式舍入到更短的精度,结果将与我们直接舍入到更短精度的结果相同.