DecimalFormat 用的是rounding modes 查了下api UP Rounding mode to round away from zero. DOWN Rounding mode to round towards zero. CEILING Rounding mode to round towards positive infinity. FLOOR Rounding mode to round towards negative infinity. HALF_UP Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. HALF_DOWN Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. HALF_EVEN Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.
Rounding Mode
最新推荐文章于 2024-06-23 20:55:27 发布
本文详细介绍了Java中DecimalFormat类使用的RoundingMode选项。包括UP、DOWN、CEILING、FLOOR、HALF_UP、HALF_DOWN及HALF_EVEN等不同舍入模式的含义及其在数值处理中的应用。
1124

被折叠的 条评论
为什么被折叠?



