nd4j-common/src/main/java/org/nd4j/linalg/util/BigDecimalMath.java
static public BigDecimal powRound(final BigDecimal x, final int n) {
        /* The relative error in the result is n times the relative error in the input.
         * The estimation is slightly optimistic due to the integer rounding of the logarithm.
         */
        MathContext mc = new MathContext(x.precision() - (int) Math.log10((double) (Math.abs(n))));
        return x.pow(n, mc);
    }
static public BigDecimal powRound(final BigDecimal x, final int n) {
        /* The relative error in the result is n times the relative error in the input.
         * The estimation is slightly optimistic due to the integer rounding of the logarithm.
         */
        MathContext mc = new MathContext(x.precision() - (int) Math.log10((double) (Math.abs(n))));
        return x.pow(n, mc);
    }
static public BigDecimal powRound ( final BigDecimal x , final int n ) { /* The relative error in the result is n times the relative error in the input.
         * The estimation is slightly optimistic due to the integer rounding of the logarithm.
         */ MathContext mc = new MathContext ( x . precision ( ) - ( int ) Math . log10 ( ( double ) ( Math . abs ( n ) ) ) ) ; return x . pow ( n , mc ) ; }
Raise to an integer power and round.

@param x The base.
@param n The exponent.
@return x^n.
Raise to an integer power and round .