calculate hypotenuse