## 1. Java, BigDecimal. Problems with division stackoverflow.comI'm trying to calculate a percentage "factor". That is, given a 20%, convert it into 0.2 (my intention is to later multiply values by that and get the 20% of the ... |

## 2. regarding bigdecimal.divide problem coderanch.com |

## 3. BigDecimal divide question coderanch.comimport java.math.*; public class BDDivide { public static void main(String[] args) { BigDecimal bd = new BigDecimal(0.4); MathContext mc1 = new MathContext(2, RoundingMode.HALF_EVEN); // Divide by 3 MathContext mc = new MathContext((int) Math.min(bd.precision() + (long) Math.ceil(10.0 * BigDecimal.valueOf(3).precision() / 3.0), Integer.MAX_VALUE), RoundingMode.HALF_EVEN); BigDecimal quotient = bd.divide(BigDecimal.valueOf(3), mc).round(mc1); System.out.println("The value of quotient : " + quotient); } } |

## 4. BigDecimal divide() coderanch.comSo I was noticing imprecision with division of large numbers, and have concluded by process of elimination that it stems from the divide() method. Would it be possible to fix the method to make it accurate to more sig figs? Or is there an inevitable reason for the shortcoming? What made me notice it was calculating derangements (aka subfactorials). I used ... |

## 5. Divide bigdecimal again java-forums.orgHi Java world, I have a web page that is calculating some statistics. As such I need to work with some very large numbers. I've pulled in the dll allowing me to work with BigInteger and BigDecimal. however I am able to calculate all my numbers (as these are multiplication) but when it comes producing the required result I need to ... |

## 6. Problem with division of BigDecimal forums.oracle.comAgain, have a look in the API for the details. Much luck. edit: also, I don't see why you're using the String constructor for your last BigDecimal object. Why not simply get the result of division and multiplication and use the BigDecimal that's returned rather than using the toString representation and then converting to BigDecimal? Edited by: Encephalopathic on May 8, ... |

## 7. Query on divide() method of BigDecimal class forums.oracle.comjava_learner_s wrote: Just a query, how come the BigDecimal doesn't care about the precision when we are using int values? It does. It uses the exact same precision that you specified: to the nearest 1. In scientific and engineering applications, when you present a number you implicitly attach a precision to it. Writing 1000 to an engineer or scientist means "1000 ... |