factorial must change to ==>
public static BigDecimal factorial(long x) {
BigDecimal result = BigDecimal.valueOf(1);
for (long i = 2; i <= x; i++) {
result=result.multiply(BigDecimal.valueOf(i));
}
return result;
}
becos is x is big enough,result will bigger than Long.maxVal()
Original issue reported on code.google.com by xuhengb...@gmail.com on 13 Mar 2014 at 3:05
Original issue reported on code.google.com by
xuhengb...@gmail.com
on 13 Mar 2014 at 3:05