2
有人可以說我問哪裏是問題嗎?錯誤與BigDecimal
double interval;
BigDecimal diff = BigDecimal.valueOf(17);
int n=39;
BigDecimal N = BigDecimal.valueOf(n);
interval = diff.divide(N).doubleValue();//line26
System.out.println(interval);
我有這樣的錯誤
Exception in thread "main" java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
at java.math.BigDecimal.divide(BigDecimal.java:1603)
at newlogoot.class.main(class.java:26)
Java Result: 1
我愛你彼得:d – Mehdi 2012-04-25 15:54:22