Here's the problem
bd1.divide(bd2)
You need to use one of the overloaded divide()
methods that takes a rounding mode (in various forms) - you cannot do the rounding after the division because with a nonterminating fraction the intermediate result would either already need to be rounded, or require infinite storage space.