nd4j-common/src/main/java/org/nd4j/linalg/util/BigDecimalMath.java
static public BigDecimal hypot(final int n, final BigDecimal x) {
        /* compute n^2+x^2 in infinite precision
         */
        BigDecimal z = (new BigDecimal(n)).pow(2).add(x.pow(2));
        /* Truncate to the precision set by x. Absolute error = in z (square of the result) is |2*x*xerr|,
         * where the error is 1/2 of the ulp. Two intermediate protection digits.
         * zerr is a signed value, but used only in conjunction with err2prec(), so this feature does not harm.
         */
        double zerr = x.doubleValue() * x.ulp().doubleValue();
        MathContext mc = new MathContext(2 + err2prec(z.doubleValue(), zerr));
        /* Pull square root */
        z = sqrt(z.round(mc));
        /* Final rounding. Absolute error in the square root is x*xerr/z, where zerr holds 2*x*xerr.
         */
        mc = new MathContext(err2prec(z.doubleValue(), 0.5 * zerr / z.doubleValue()));
        return z.round(mc);
    }
static public BigDecimal hypot(final int n, final BigDecimal x) {
        /* compute n^2+x^2 in infinite precision
         */
        BigDecimal z = (new BigDecimal(n)).pow(2).add(x.pow(2));
        /* Truncate to the precision set by x. Absolute error = in z (square of the result) is |2*x*xerr|,
         * where the error is 1/2 of the ulp. Two intermediate protection digits.
         * zerr is a signed value, but used only in conjunction with err2prec(), so this feature does not harm.
         */
        double zerr = x.doubleValue() * x.ulp().doubleValue();
        MathContext mc = new MathContext(2 + err2prec(z.doubleValue(), zerr));
        /* Pull square root */
        z = sqrt(z.round(mc));
        /* Final rounding. Absolute error in the square root is x*xerr/z, where zerr holds 2*x*xerr.
         */
        mc = new MathContext(err2prec(z.doubleValue(), 0.5 * zerr / z.doubleValue()));
        return z.round(mc);
    }
static public BigDecimal hypot ( final int n , final BigDecimal x ) { /* compute n^2+x^2 in infinite precision
         */ BigDecimal z = ( new BigDecimal ( n ) ) . pow ( 2 ) . add ( x . pow ( 2 ) ) ; /* Truncate to the precision set by x. Absolute error = in z (square of the result) is |2*x*xerr|,
         * where the error is 1/2 of the ulp. Two intermediate protection digits.
         * zerr is a signed value, but used only in conjunction with err2prec(), so this feature does not harm.
         */ double zerr = x . doubleValue ( ) * x . ulp ( ) . doubleValue ( ) ; MathContext mc = new MathContext ( 2 + err2prec ( z . doubleValue ( ) , zerr ) ) ; /* Pull square root */ z = sqrt ( z . round ( mc ) ) ; /* Final rounding. Absolute error in the square root is x*xerr/z, where zerr holds 2*x*xerr.
         */ mc = new MathContext ( err2prec ( z . doubleValue ( ) , 0.5 * zerr / z . doubleValue ( ) ) ) ; return z . round ( mc ) ; }
The hypotenuse.

@param n the first argument.
@param x the second argument.
@return the square root of the sum of the squares of the two arguments, sqrt(n^2+x^2).
The hypotenuse .