nd4j-common/src/main/java/org/nd4j/linalg/util/BigDecimalMath.java
static public BigDecimal divideRound(final int n, final BigDecimal x) {
        /* The estimation of the relative error in the result is |err(x)/x|
         */
        MathContext mc = new MathContext(x.precision());


        return new BigDecimal(n).divide(x, mc);


    }
static public BigDecimal divideRound(final int n, final BigDecimal x) {
        /* The estimation of the relative error in the result is |err(x)/x|
         */
        MathContext mc = new MathContext(x.precision());


        return new BigDecimal(n).divide(x, mc);


    }
Divide and round.

@param n The numerator.
@param x The denominator.
@return the divided n/x.