nd4j-common/src/main/java/org/nd4j/linalg/util/BigDecimalMath.java
static public BigDecimal hypot(final BigDecimal x, final BigDecimal y) {
        /* compute x^2+y^2
         */
        BigDecimal z = x.pow(2).add(y.pow(2));
        /* truncate to the precision set by x and y. Absolute error = 2*x*xerr+2*y*yerr,
         * where the two errors are 1/2 of the ulp’s. Two intermediate protectio digits.
         */
        BigDecimal zerr = x.abs().multiply(x.ulp()).add(y.abs().multiply(y.ulp()));
        MathContext mc = new MathContext(2 + err2prec(z, zerr));
        /* Pull square root */
        z = sqrt(z.round(mc));
        /* Final rounding. Absolute error in the square root is (y*yerr+x*xerr)/z, where zerr holds 2*(x*xerr+y*yerr).
         */
        mc = new MathContext(err2prec(z.doubleValue(), 0.5 * zerr.doubleValue() / z.doubleValue()));
        return z.round(mc);
    }
static public BigDecimal hypot(final BigDecimal x, final BigDecimal y) {
        /* compute x^2+y^2
         */
        BigDecimal z = x.pow(2).add(y.pow(2));
        /* truncate to the precision set by x and y. Absolute error = 2*x*xerr+2*y*yerr,
         * where the two errors are 1/2 of the ulp’s. Two intermediate protectio digits.
         */
        BigDecimal zerr = x.abs().multiply(x.ulp()).add(y.abs().multiply(y.ulp()));
        MathContext mc = new MathContext(2 + err2prec(z, zerr));
        /* Pull square root */
        z = sqrt(z.round(mc));
        /* Final rounding. Absolute error in the square root is (y*yerr+x*xerr)/z, where zerr holds 2*(x*xerr+y*yerr).
         */
        mc = new MathContext(err2prec(z.doubleValue(), 0.5 * zerr.doubleValue() / z.doubleValue()));
        return z.round(mc);
    }
static public BigDecimal hypot ( final BigDecimal x , final BigDecimal y ) { /* compute x^2+y^2
         */ BigDecimal z = x . pow ( 2 ) . add ( y . pow ( 2 ) ) ; /* truncate to the precision set by x and y. Absolute error = 2*x*xerr+2*y*yerr,
         * where the two errors are 1/2 of the ulp’s. Two intermediate protectio digits.
         */ BigDecimal zerr = x . abs ( ) . multiply ( x . ulp ( ) ) . add ( y . abs ( ) . multiply ( y . ulp ( ) ) ) ; MathContext mc = new MathContext ( 2 + err2prec ( z , zerr ) ) ; /* Pull square root */ z = sqrt ( z . round ( mc ) ) ; /* Final rounding. Absolute error in the square root is (y*yerr+x*xerr)/z, where zerr holds 2*(x*xerr+y*yerr).
         */ mc = new MathContext ( err2prec ( z . doubleValue ( ) , 0.5 * zerr . doubleValue ( ) / z . doubleValue ( ) ) ) ; return z . round ( mc ) ; }
The hypotenuse.

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