62-EL expression rounding takes either a fixed decimal

Internet search a lot of information said EL expression can not be rounded, indeed EL expression for the floating-point result of the division. 
E.g. $ {8/7}, {6/7} $, $ {12/7} results page displayed are: 
1.1428571428571428 
0.8571428571428571 
1.7142857142857142 

Now my purpose only rounded front, in which case I use the EL expression <fmt: formatNumber /> tags, for example: 
<FMT: formatNumber type = "Number" value = "$ {8/7)}" maxFractionDigits = "0" /> 
results 1. 
maxFractionDigits = "0" indicates reserved 0 decimal places, i.e. rounding Note: integer rounding at this time is taken. 
If the result is $ 0 {1/7}, {6/7} $ if the result is 1, this method is suitable for rounding rounding like. 
Of course, you want to keep a fixed decimal places just maxFractionDigits = "0" in the 0 to make the appropriate modifications on it, like a few decimal places to change a few. 

Of course, there are no rounded rounding method. 
For example: 
<FMT: formatNumber type = "Number" value = "$ {13-13 of%. 7) /. 7)}" /> 
If the result of using the above method 2, as a result of this method, were taken of different purposes. 
In fact, to get the remainder, the remainder subtract and divide, so the result is just an integer, and there is no problem rounding up. Because after subtracting the remainder, exactly divisible, after I test plus maxFractionDigits = "0" already does not work. 

Guess you like

Origin www.cnblogs.com/zhumengdexiaobai/p/11221208.html