BigDecimal 사칙연산
-
[JAVA] BigDecimal 사칙연산과 Non-terminating decimal expansion; no exact representable decimal resultJAVA 2021. 6. 23. 16:36
BigDecimal number1 = new BigDecimal("250.125"); BigDecimal number2 = new BigDecimal("150.352"); 더하기 : number1.add(number2); 빼기 : number1.subtract(number2); 곱하기 : number1.multiply(number2); 나누기 : 올림 - number1.divide(number2 , 2(소수점자리수), BigDecimal.ROUND_UP); 버림 - number1.divide(number2 , 4, BigDecimal.ROUND_DOWN); 반올림 - number1.divide(number2 , 3, BigDecimal.ROUND_HALF_UP); 반내림 - number1.divide(n..