博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
bigdecimal 保留小数位
阅读量:7091 次
发布时间:2019-06-28

本文共 1063 字,大约阅读时间需要 3 分钟。

hot3.png

参数定义

ROUND_CEILING 

Rounding mode to round towards positive infinity. 
向正无穷方向舍入 
ROUND_DOWN 
Rounding mode to round towards zero. 
向零方向舍入 
ROUND_FLOOR 
Rounding mode to round towards negative infinity. 
向负无穷方向舍入 
ROUND_HALF_DOWN 
Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. 
向(距离)最近的一边舍入,除非两边(的距离)是相等,如果是这样,向下舍入, 例如1.55 保留一位小数结果为1.5 
ROUND_HALF_EVEN 
Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor. 
向(距离)最近的一边舍入,除非两边(的距离)是相等,如果是这样,如果保留位数是奇数,使用ROUND_HALF_UP ,如果是偶数,使用ROUND_HALF_DOWN 
ROUND_HALF_UP 
Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. 
向(距离)最近的一边舍入,除非两边(的距离)是相等,如果是这样,向上舍入, 1.55保留一位小数结果为1.6 
ROUND_UNNECESSARY 
Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary. 
计算结果是精确的,不需要舍入模式 
ROUND_UP 
Rounding mode to round away from zero. 
向远离0的方向舍入

转载于:https://my.oschina.net/iioschina/blog/1784862

你可能感兴趣的文章
LinkedBlockingQueue和ArrayBlockingQueue区别
查看>>
面试题38-数字在排序数组中出现的次数
查看>>
再次总结移动端事【件穿穿透】问题
查看>>
vue示例之transition-另外发现一个vue(可能的)小bug
查看>>
linux高级编程day07 笔记
查看>>
基于IPv6的数据包分析(第三组)
查看>>
JavaScript获取网页属性包括宽、高等
查看>>
Angular 4.0 架构详解
查看>>
JAVA递归遍历指定目录下的所有文件(包括子目录下的文件)
查看>>
range()和xrange()的区别
查看>>
快速搭建fabric-v1.1.0的chaincode开发环境
查看>>
Python学习的相关文件链接
查看>>
JSON 入门
查看>>
constructor中能不能有返回值?
查看>>
03动物类
查看>>
池化层pooling
查看>>
GPS坐标转百度地图并且加载地图示例.支持微信端访问
查看>>
浏览器自动跳转
查看>>
数据可视化-EChart2.0使用总结2
查看>>
继承的设计技巧
查看>>