Calculate hypotenuse of a triangle