- ©«¤l
- 2
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 54
- ÂI¦W
- 0
- §@·~¨t²Î
- windows
- ³nÅ骩¥»
- win7
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- taiwan
- µù¥U®É¶¡
- 2013-12-30
- ³Ì«áµn¿ý
- 2020-11-28
|
[µo°Ý] HALF_DOWN©MHALF_UPªº®t§O?
µ{¦¡½X¦p¤U:
package _03.bigdecimal;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class BigDecimalDemo {
public static void main(String[] args) {
BigDecimal bd2=BigDecimal.valueOf(11);
BigDecimal bd3=new BigDecimal("2.3");
BigDecimal bdDiv = bd2.divide(bd3,38,RoundingMode.HALF_UP);
System.out.println(bdDiv);
BigDecimal bdDivDOWN = bd2.divide(bd3,10, RoundingMode.HALF_DOWN);
System.out.println(bdDivDOWN);
BigDecimal bdDivUP = bd2.divide(bd3,10, RoundingMode.HALF_UP);
System.out.println(bdDivUP);
}
}
½sĶµ²ªG¦p¤U:
4.78260869565217391304347826086956521739
4.7826086957
4.7826086957
½Ð°ÝbdDivDOWN ¬°¤°»ò©MbdDivUP ªºµª®×¬Û¦P? |
|