I want to divide 2 big decimals and retain maximum possible number of digits(say 1000 digits) in the non-terminating division result. What code shall I write to do this ?
Please note : Is it possible to have a high accuracy implementation as I am dealing with important data .
Use an overloaded divide
method of BigDecimal
that takes a scale
as an argument; you can get an arbitary scale that way.
divide(BigDecimal divisor, int scale, RoundingMode roundingMode)