Development problem: BigDecimal division error Non-terminating decimal expansion; no exact representable decimal result.
// result is the calculation result result=cigaretteNum1.divide(result1);
When there is an infinite decimal like 1/3 in the division, an error will be reported if you don’t specify a few decimal places to keep
// result is the calculation result result=cigaretteNum1.divide(result1, 2 ,BigDecimal.ROUND_HALF_UP);
Keep two significant digits and round up
- java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal …
- ToFixed, toexponential, toprecision in JS
- Python: __ new__ Method and the processing of typeerror: object() takes no parameters
- Tomcat Error: Invalid maximum heap size
- The entity type XXX is not part of the model for the current context.
- Inkscape – rounding corners of shapes
- How to Solve TypeError: not all arguments converted during string formatting
- You have not completed the merge: You have not concluded your merge (MERGE_HEAD exists)
- React Error: Import in body of module; reorder to top import/first
- How to solve the infinite loop of react. Useeffect()?