Ceiling of a number in JSTL/EL

前端 未结 2 1454
庸人自扰
庸人自扰 2020-12-09 10:14

In JSTL,


returns 2 and the following



        
2条回答
  •  温柔的废话
    2020-12-09 10:54

    The default rounding mode of DecimalFormat that is used by is RoundingMode.HALF_EVEN. There is no way to change that via any tag attribute. Just add 0.5 to the value when it's not an odd integer to make it to behave like RoundingMode.CEILING.

    
    

提交回复
热议问题