# CFLib.org – Common Function Library Project

## Hypotenuse(x, y)

##### Last updated July 18, 2001

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Returns the hypotenuse of a right triangle by Pythagorean theorem, given the lengths of the other two sides.

Return Values:
Returns a simple value.

Example:

``````<CFSET x=3>
<CFSET y=4>
<CFOUTPUT>
Given:
<UL>
<LI>x = 3
<LI>y = 4
</UL>
The length of the hypotenuse = #Hypotenuse(x, y)#
</CFOUTPUT>``````

Parameters:

Name Description Required
x Length of one side adjacent to the right angle Yes
y Length of the other side adjacent to the right angle Yes

Full UDF Source:

``````/**
* Returns the hypotenuse of a right triangle by Pythagorean theorem, given the lengths of the other two sides.
*
* @param x 	            Length of one side adjacent to the right angle
* @param y 	            Length of the other side adjacent to the right angle
* @return Returns a simple value.
* @author Joel Cox (jlcox@goodyear.com)
* @version 1.0, July 18, 2001
*/
function Hypotenuse(x,y)
{
Return(Sqr(x^2 + y^2));
}``````

date2ExcelDate
May 5, 2016

CapFirst
April 25, 2016